From 3db4229918fd03531e2baa74b2ca4e5fd6e93959 Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Mon, 16 Jul 2018 13:54:30 -0700 Subject: [PATCH] First big chunk of the refactor mid-refactor of `take_overall_damage` Fully refactors the (?:take|heal)_(?:overall|organ)_damage procs Allows the dead to examine Removes the `blinded` var Refactor cyborg components so vision loss is instant Robot life/death updates instantly Adds instant updates for damage overlays and HUD icons for humans Final reconciliation with the species refactor Adds a stat debugging system and debugging logs Also fixes instant death on species change "Debugging logs" are used for stuff an admin wouldn't care about but someone debugging would I used it to fix people dying instantly when changing species due to temporary deletion of the brain Fox's requests Adds a more careful updating system to our reagents system --- code/__DEFINES/mobs.dm | 12 + code/__DEFINES/reagents.dm | 5 +- code/datums/datumvars.dm | 2 +- code/datums/diseases/beesease.dm | 3 +- code/datums/diseases/brainrot.dm | 3 - code/datums/diseases/dna_spread.dm | 3 +- code/datums/diseases/flu.dm | 2 - code/datums/diseases/gbs.dm | 4 +- code/datums/diseases/rhumba_beat.dm | 4 +- code/defines/procs/statistics.dm | 6 +- code/game/dna/genes/goon_powers.dm | 2 +- code/game/gamemodes/blob/blobs/blob_mobs.dm | 10 +- .../gamemodes/changeling/powers/fakedeath.dm | 1 + .../gamemodes/changeling/powers/fleshmend.dm | 4 +- .../gamemodes/changeling/powers/revive.dm | 28 +- code/game/gamemodes/cult/cult_structures.dm | 4 +- code/game/gamemodes/miniantags/borer/borer.dm | 2 +- .../gamemodes/miniantags/guardian/guardian.dm | 5 +- code/game/gamemodes/miniantags/morph/morph.dm | 15 +- .../gamemodes/miniantags/revenant/revenant.dm | 12 +- .../miniantags/slaughter/slaughter.dm | 24 +- .../shadowling/shadowling_abilities.dm | 11 +- code/game/machinery/cloning.dm | 6 +- code/game/machinery/computer/aifixer.dm | 26 +- code/game/machinery/computer/camera.dm | 4 +- code/game/machinery/cryo.dm | 2 +- code/game/machinery/rechargestation.dm | 7 +- code/game/machinery/transformer.dm | 1 - .../mecha/equipment/tools/medical_tools.dm | 2 - .../mecha/equipment/tools/mining_tools.dm | 1 - code/game/mecha/equipment/tools/work_tools.dm | 2 - code/game/objects/items.dm | 3 +- code/game/objects/items/devices/aicard.dm | 1 - .../objects/items/robot/robot_upgrades.dm | 8 +- code/game/objects/items/shooting_range.dm | 4 +- code/game/objects/items/stacks/medical.dm | 1 - code/game/objects/items/stacks/nanopaste.dm | 5 +- code/game/objects/items/weapons/defib.dm | 2 - code/game/objects/items/weapons/lighters.dm | 1 - code/game/objects/items/weapons/shards.dm | 4 +- code/game/objects/structures.dm | 1 - .../closets/secure/secure_closets.dm | 4 +- .../structures/crates_lockers/crates.dm | 4 +- code/game/objects/structures/lamarr_cage.dm | 7 +- code/game/objects/structures/morgue.dm | 8 +- code/game/verbs/suicide.dm | 25 +- code/modules/assembly/mousetrap.dm | 1 - .../awaymissions/mission_code/wildwest.dm | 5 +- code/modules/flufftext/Hallucination.dm | 6 +- code/modules/mining/minebot.dm | 8 +- code/modules/mob/dead/observer/observer.dm | 1 - code/modules/mob/death.dm | 92 +- code/modules/mob/hear_say.dm | 4 +- code/modules/mob/living/carbon/alien/alien.dm | 14 +- .../mob/living/carbon/alien/alien_defense.dm | 2 - code/modules/mob/living/carbon/alien/death.dm | 21 +- .../living/carbon/alien/humanoid/humanoid.dm | 6 +- .../carbon/alien/humanoid/humanoid_defense.dm | 3 +- .../mob/living/carbon/alien/humanoid/life.dm | 10 +- .../mob/living/carbon/alien/larva/death.dm | 15 - .../mob/living/carbon/alien/larva/larva.dm | 2 + .../mob/living/carbon/alien/larva/life.dm | 10 +- .../mob/living/carbon/alien/larva/powers.dm | 10 +- code/modules/mob/living/carbon/brain/death.dm | 34 +- code/modules/mob/living/carbon/brain/life.dm | 13 +- .../mob/living/carbon/brain/update_status.dm | 14 +- code/modules/mob/living/carbon/carbon.dm | 4 +- .../mob/living/carbon/carbon_defense.dm | 4 +- code/modules/mob/living/carbon/death.dm | 9 +- code/modules/mob/living/carbon/human/death.dm | 65 +- code/modules/mob/living/carbon/human/human.dm | 6 +- .../mob/living/carbon/human/human_damage.dm | 113 +- .../mob/living/carbon/human/human_defense.dm | 10 +- .../carbon/human/interactive/interactive.dm | 5 +- code/modules/mob/living/carbon/human/life.dm | 39 +- .../living/carbon/human/species/_species.dm | 52 +- .../living/carbon/human/species/station.dm | 1040 +++++++++++++++++ .../mob/living/carbon/human/update_stat.dm | 20 + code/modules/mob/living/carbon/life.dm | 142 +-- code/modules/mob/living/carbon/slime/death.dm | 16 +- code/modules/mob/living/carbon/slime/life.dm | 9 +- .../modules/mob/living/carbon/slime/powers.dm | 4 +- .../mob/living/carbon/update_status.dm | 16 +- code/modules/mob/living/damage_procs.dm | 206 +++- code/modules/mob/living/death.dm | 81 +- code/modules/mob/living/life.dm | 49 +- code/modules/mob/living/living.dm | 131 +-- code/modules/mob/living/living_defense.dm | 2 +- code/modules/mob/living/living_defines.dm | 2 - code/modules/mob/living/login.dm | 6 +- code/modules/mob/living/silicon/ai/ai.dm | 2 - code/modules/mob/living/silicon/ai/death.dm | 20 +- code/modules/mob/living/silicon/ai/life.dm | 29 +- .../mob/living/silicon/ai/update_status.dm | 7 +- .../modules/mob/living/silicon/decoy/death.dm | 10 +- code/modules/mob/living/silicon/decoy/life.dm | 9 +- code/modules/mob/living/silicon/pai/death.dm | 33 +- code/modules/mob/living/silicon/pai/life.dm | 5 +- code/modules/mob/living/silicon/pai/pai.dm | 10 +- .../mob/living/silicon/pai/update_status.dm | 3 +- .../mob/living/silicon/robot/component.dm | 65 +- .../modules/mob/living/silicon/robot/death.dm | 26 +- .../mob/living/silicon/robot/drone/drone.dm | 24 +- .../silicon/robot/drone/drone_damage.dm | 18 +- .../silicon/robot/drone/update_status.dm | 5 +- code/modules/mob/living/silicon/robot/life.dm | 41 +- .../modules/mob/living/silicon/robot/robot.dm | 18 +- .../mob/living/silicon/robot/robot_damage.dm | 46 +- .../mob/living/silicon/robot/robot_defense.dm | 3 +- .../mob/living/silicon/robot/robot_modules.dm | 16 +- .../mob/living/silicon/robot/update_status.dm | 23 +- code/modules/mob/living/silicon/silicon.dm | 2 +- .../mob/living/simple_animal/bot/bot.dm | 9 +- .../mob/living/simple_animal/bot/medbot.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 6 +- .../simple_animal/friendly/cockroach.dm | 8 +- .../living/simple_animal/friendly/corgi.dm | 13 +- .../simple_animal/friendly/corgi_powers.dm | 7 +- .../mob/living/simple_animal/friendly/crab.dm | 13 +- .../simple_animal/friendly/farm_animals.dm | 5 +- .../living/simple_animal/friendly/mouse.dm | 5 +- .../living/simple_animal/hostile/hivebot.dm | 5 +- .../living/simple_animal/hostile/hostile.dm | 5 +- .../hostile/megafauna/hierophant.dm | 23 +- .../simple_animal/hostile/megafauna/legion.dm | 13 +- .../hostile/megafauna/megafauna.dm | 29 +- .../mob/living/simple_animal/hostile/mimic.dm | 20 +- .../simple_animal/hostile/mining/hivelord.dm | 32 +- .../living/simple_animal/hostile/mushroom.dm | 7 +- .../simple_animal/hostile/spaceworms.dm | 10 +- .../hostile/terror_spiders/chem.dm | 19 +- .../hostile/terror_spiders/gray.dm | 6 +- .../hostile/terror_spiders/mother.dm | 37 +- .../hostile/terror_spiders/prince.dm | 9 +- .../hostile/terror_spiders/purple.dm | 6 +- .../hostile/terror_spiders/queen.dm | 6 +- .../hostile/terror_spiders/terror_ai.dm | 6 +- .../hostile/terror_spiders/terror_spiders.dm | 11 +- .../hostile/terror_spiders/white.dm | 9 +- .../simple_animal/hostile/winter_mobs.dm | 38 +- .../mob/living/simple_animal/parrot.dm | 11 +- .../living/simple_animal/posessed_object.dm | 24 +- .../mob/living/simple_animal/powers.dm | 10 +- .../modules/mob/living/simple_animal/shade.dm | 31 +- .../mob/living/simple_animal/simple_animal.dm | 56 +- .../mob/living/simple_animal/tribbles.dm | 10 +- code/modules/mob/living/stat_states.dm | 13 +- code/modules/mob/living/status_procs.dm | 109 +- code/modules/mob/living/update_status.dm | 28 +- code/modules/mob/mob.dm | 26 +- code/modules/mob/mob_defines.dm | 6 +- code/modules/mob/mob_helpers.dm | 9 +- code/modules/mob/update_status.dm | 2 +- code/modules/reagents/chemistry/holder.dm | 41 +- code/modules/reagents/chemistry/reagents.dm | 17 +- .../reagents/chemistry/reagents/admin.dm | 33 +- .../reagents/chemistry/reagents/alcohol.dm | 82 +- .../reagents/chemistry/reagents/disease.dm | 22 +- .../reagents/chemistry/reagents/drink_base.dm | 5 +- .../reagents/chemistry/reagents/drink_cold.dm | 7 +- .../reagents/chemistry/reagents/drinks.dm | 113 +- .../reagents/chemistry/reagents/drugs.dm | 289 +++-- .../reagents/chemistry/reagents/food.dm | 163 +-- .../reagents/chemistry/reagents/medicine.dm | 404 ++++--- .../reagents/chemistry/reagents/misc.dm | 25 +- .../chemistry/reagents/paradise_pop.dm | 26 +- .../chemistry/reagents/pyrotechnic.dm | 26 +- .../reagents/chemistry/reagents/toxins.dm | 319 ++--- .../reagents/chemistry/reagents/water.dm | 47 +- code/modules/recycling/disposal.dm | 2 +- code/modules/surgery/organs/organ_external.dm | 14 +- code/modules/surgery/organs/vocal_cords.dm | 2 +- code/modules/vr/vr_avatar.dm | 3 +- paradise.dme | 2 +- 174 files changed, 3299 insertions(+), 2045 deletions(-) delete mode 100644 code/modules/mob/living/carbon/alien/larva/death.dm create mode 100644 code/modules/mob/living/carbon/human/species/station.dm create mode 100644 code/modules/mob/living/carbon/human/update_stat.dm diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 056bc25be5d..580cb85d696 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -132,6 +132,18 @@ #define EMOTE_VISUAL 1 //A mob emote is visual #define EMOTE_SOUND 2 //A mob emote is sound +#define STATUS_UPDATE_HEALTH 1 +#define STATUS_UPDATE_STAT 2 +#define STATUS_UPDATE_CANMOVE 4 +#define STATUS_UPDATE_STAMINA 8 +#define STATUS_UPDATE_BLIND 16 +#define STATUS_UPDATE_BLURRY 32 +#define STATUS_UPDATE_NEARSIGHTED 64 +#define STATUS_UPDATE_DRUGGY 128 + +#define STATUS_UPDATE_NONE 0 +#define STATUS_UPDATE_ALL (~0) + //Human sub-species #define isshadowling(A) (is_species(A, /datum/species/shadow/ling)) #define isshadowlinglesser(A) (is_species(A, /datum/species/shadow/ling/lesser)) diff --git a/code/__DEFINES/reagents.dm b/code/__DEFINES/reagents.dm index 3e81a67b1b2..0d20a3edb74 100644 --- a/code/__DEFINES/reagents.dm +++ b/code/__DEFINES/reagents.dm @@ -1,3 +1,6 @@ #define SOLID 1 #define LIQUID 2 -#define GAS 3 \ No newline at end of file +#define GAS 3 + +#define REAGENT_OVERDOSE_EFFECT 1 +#define REAGENT_OVERDOSE_FLAGS 2 diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 31c791f5127..656c12fa9d8 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -31,7 +31,7 @@ /datum/proc/vv_get_var(var_name) switch(var_name) - if("attack_log") + if("attack_log", "debug_log") return debug_variable(var_name, vars[var_name], 0, src, sanitize = FALSE) if("vars") return debug_variable(var_name, list(), 0, src) diff --git a/code/datums/diseases/beesease.dm b/code/datums/diseases/beesease.dm index 4f1672346ed..9d7faff6af3 100644 --- a/code/datums/diseases/beesease.dm +++ b/code/datums/diseases/beesease.dm @@ -24,7 +24,6 @@ to_chat(affected_mob, "Your stomach stings painfully.") if(prob(20)) affected_mob.adjustToxLoss(2) - affected_mob.updatehealth() if(4) if(prob(10)) affected_mob.visible_message("[affected_mob] buzzes.", \ @@ -37,4 +36,4 @@ new /mob/living/simple_animal/hostile/poison/bees(affected_mob.loc) //if(5) //Plus if you die, you explode into bees - return \ No newline at end of file + return diff --git a/code/datums/diseases/brainrot.dm b/code/datums/diseases/brainrot.dm index bb95e4aa733..cacd229c429 100644 --- a/code/datums/diseases/brainrot.dm +++ b/code/datums/diseases/brainrot.dm @@ -25,7 +25,6 @@ to_chat(affected_mob, "You don't feel like yourself.") if(prob(5)) affected_mob.adjustBrainLoss(1) - affected_mob.updatehealth() if(3) if(prob(2)) affected_mob.emote("stare") @@ -33,7 +32,6 @@ affected_mob.emote("drool") if(prob(10) && affected_mob.getBrainLoss()<=98)//shouldn't retard you to death now affected_mob.adjustBrainLoss(2) - affected_mob.updatehealth() if(prob(2)) to_chat(affected_mob, "Your try to remember something important...but can't.") @@ -44,7 +42,6 @@ affected_mob.emote("drool") if(prob(15) && affected_mob.getBrainLoss()<=98) //shouldn't retard you to death now affected_mob.adjustBrainLoss(3) - affected_mob.updatehealth() if(prob(2)) to_chat(affected_mob, "Strange buzzing fills your head, removing all thoughts.") if(prob(3)) diff --git a/code/datums/diseases/dna_spread.dm b/code/datums/diseases/dna_spread.dm index 7c5cde5b330..b0238b6418a 100644 --- a/code/datums/diseases/dna_spread.dm +++ b/code/datums/diseases/dna_spread.dm @@ -41,7 +41,6 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(2) - affected_mob.updatehealth() if(4) if(!transformed && !carrier) //Save original dna for when the disease is cured. @@ -69,4 +68,4 @@ affected_mob.domutcheck() to_chat(affected_mob, "You feel more like yourself.") - return ..() \ No newline at end of file + return ..() diff --git a/code/datums/diseases/flu.dm b/code/datums/diseases/flu.dm index 4a1a929101e..dc68cc3c7d2 100644 --- a/code/datums/diseases/flu.dm +++ b/code/datums/diseases/flu.dm @@ -31,7 +31,6 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(1) - affected_mob.updatehealth() if(3) if(affected_mob.lying && prob(15)) @@ -50,5 +49,4 @@ to_chat(affected_mob, "Your stomach hurts.") if(prob(20)) affected_mob.adjustToxLoss(1) - affected_mob.updatehealth() return diff --git a/code/datums/diseases/gbs.dm b/code/datums/diseases/gbs.dm index 8ba67750c06..371f38238a1 100644 --- a/code/datums/diseases/gbs.dm +++ b/code/datums/diseases/gbs.dm @@ -18,7 +18,6 @@ if(2) if(prob(45)) affected_mob.adjustToxLoss(5) - affected_mob.updatehealth() if(prob(1)) affected_mob.emote("sneeze") if(3) @@ -32,7 +31,6 @@ if(prob(10)) affected_mob.emote("cough") affected_mob.adjustToxLoss(5) - affected_mob.updatehealth() if(5) to_chat(affected_mob, "Your body feels as if it's trying to rip itself open...") if(prob(50)) @@ -50,4 +48,4 @@ cure_chance = 10 agent = "gibbis" spread_flags = NON_CONTAGIOUS - disease_flags = CURABLE \ No newline at end of file + disease_flags = CURABLE diff --git a/code/datums/diseases/rhumba_beat.dm b/code/datums/diseases/rhumba_beat.dm index fc26f005340..1ba2270008b 100644 --- a/code/datums/diseases/rhumba_beat.dm +++ b/code/datums/diseases/rhumba_beat.dm @@ -19,7 +19,6 @@ if(2) if(prob(45)) affected_mob.adjustToxLoss(5) - affected_mob.updatehealth() if(prob(1)) to_chat(affected_mob, "You feel strange...") if(3) @@ -35,8 +34,7 @@ to_chat(affected_mob, "You feel a burning beat inside...") if(prob(20)) affected_mob.adjustToxLoss(5) - affected_mob.updatehealth() if(5) to_chat(affected_mob, "Your body is unable to contain the Rhumba Beat...") if(prob(50)) - affected_mob.gib() \ No newline at end of file + affected_mob.gib() diff --git a/code/defines/procs/statistics.dm b/code/defines/procs/statistics.dm index 13c127e81e2..28c0b427ee2 100644 --- a/code/defines/procs/statistics.dm +++ b/code/defines/procs/statistics.dm @@ -65,12 +65,12 @@ lakey = sanitizeSQL(H.lastattacker:key) var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") var/coord = "[H.x], [H.y], [H.z]" -// to_chat(world, "INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.bruteloss], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()])") +// to_chat(world, "INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.bruteloss], [H.getFireLoss()], [H.getBrainLoss()], [H.getOxyLoss()])") establish_db_connection() if(!dbcon.IsConnected()) log_game("SQL ERROR during death reporting. Failed to connect.") else - var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')") + var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.getBrainLoss()], [H.getOxyLoss()], '[coord]')") if(!query.Execute()) var/err = query.ErrorMsg() log_game("SQL ERROR during death reporting. Error : \[[err]\]\n") @@ -105,7 +105,7 @@ if(!dbcon.IsConnected()) log_game("SQL ERROR during death reporting. Failed to connect.") else - var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')") + var/DBQuery/query = dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.getBrainLoss()], [H.getOxyLoss()], '[coord]')") if(!query.Execute()) var/err = query.ErrorMsg() log_game("SQL ERROR during death reporting. Error : \[[err]\]\n") diff --git a/code/game/dna/genes/goon_powers.dm b/code/game/dna/genes/goon_powers.dm index 2e75d15a77d..417f079a4f6 100644 --- a/code/game/dna/genes/goon_powers.dm +++ b/code/game/dna/genes/goon_powers.dm @@ -265,7 +265,7 @@ affecting = H.bodyparts_by_name[name] if(!istype(affecting, /obj/item/organ/external)) continue - affecting.heal_damage(4, 0) + affecting.heal_damage(4, 0, updating_health = FALSE) H.UpdateDamageIcon() H.updatehealth() diff --git a/code/game/gamemodes/blob/blobs/blob_mobs.dm b/code/game/gamemodes/blob/blobs/blob_mobs.dm index bae37c04c2c..e3b1d082623 100644 --- a/code/game/gamemodes/blob/blobs/blob_mobs.dm +++ b/code/game/gamemodes/blob/blobs/blob_mobs.dm @@ -97,7 +97,10 @@ loc.visible_message("The corpse of [H.name] suddenly rises!") /mob/living/simple_animal/hostile/blob/blobspore/death(gibbed) - ..() + // Only execute the below if we successfuly died + . = ..() + if(!.) + return FALSE // On death, create a small smoke of harmful gas (s-Acid) var/datum/effect_system/smoke_spread/chem/S = new var/turf/location = get_turf(src) @@ -178,5 +181,8 @@ return /mob/living/simple_animal/hostile/blob/blobbernaut/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE flick("blobbernaut_death", src) diff --git a/code/game/gamemodes/changeling/powers/fakedeath.dm b/code/game/gamemodes/changeling/powers/fakedeath.dm index a166fd74502..abd03c7efd7 100644 --- a/code/game/gamemodes/changeling/powers/fakedeath.dm +++ b/code/game/gamemodes/changeling/powers/fakedeath.dm @@ -15,6 +15,7 @@ user.emote("deathgasp") user.timeofdeath = world.time user.status_flags |= FAKEDEATH //play dead + user.update_stat("fakedeath sting") user.update_canmove() addtimer(CALLBACK(src, .proc/ready_to_regenerate, user), LING_FAKEDEATH_TIME) diff --git a/code/game/gamemodes/changeling/powers/fleshmend.dm b/code/game/gamemodes/changeling/powers/fleshmend.dm index 8ab09fc781c..6dbd4badc30 100644 --- a/code/game/gamemodes/changeling/powers/fleshmend.dm +++ b/code/game/gamemodes/changeling/powers/fleshmend.dm @@ -46,8 +46,8 @@ for(var/i in 1 to healing_ticks) if(user) var/healpertick = -(total_healing / healing_ticks) - user.heal_overall_damage((-healpertick/recent_uses), (-healpertick/recent_uses)) - user.adjustOxyLoss(healpertick/recent_uses) + user.heal_overall_damage((-healpertick/recent_uses), (-healpertick/recent_uses), updating_health = FALSE) + user.adjustOxyLoss(healpertick/recent_uses, FALSE) user.blood_volume = min(user.blood_volume + 30, BLOOD_VOLUME_NORMAL) user.updatehealth() else diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm index 3e03d49dc49..fa6a1a93405 100644 --- a/code/game/gamemodes/changeling/powers/revive.dm +++ b/code/game/gamemodes/changeling/powers/revive.dm @@ -6,22 +6,22 @@ //Revive from regenerative stasis /obj/effect/proc_holder/changeling/revive/sting_action(var/mob/living/carbon/user) - user.setToxLoss(0) - user.setOxyLoss(0) - user.setCloneLoss(0) - user.setBrainLoss(0) - user.SetParalysis(0) - user.SetStunned(0) - user.SetWeakened(0) + user.setToxLoss(0, FALSE) + user.setOxyLoss(0, FALSE) + user.setCloneLoss(0, FALSE) + user.setBrainLoss(0, FALSE) + user.SetParalysis(0, FALSE) + user.SetStunned(0, FALSE) + user.SetWeakened(0, FALSE) user.radiation = 0 - user.SetEyeBlind(0) - user.SetEyeBlurry(0) + user.SetEyeBlind(0, FALSE) + user.SetEyeBlurry(0, FALSE) user.SetEarDamage(0) user.SetEarDeaf(0) - user.heal_overall_damage(user.getBruteLoss(), user.getFireLoss()) - user.CureBlind() + user.heal_overall_damage(user.getBruteLoss(), user.getFireLoss(), updating_health = FALSE) + user.CureBlind(FALSE) user.CureDeaf() - user.CureNearsighted() + user.CureNearsighted(FALSE) user.reagents.clear_reagents() user.germ_level = 0 user.timeofdeath = 0 @@ -52,7 +52,9 @@ IO.rejuvenate() IO.trace_chemicals.Cut() H.remove_all_embedded_objects() - H.updatehealth() + user.updatehealth() + user.update_blind_effects() + user.update_blurry_effects() to_chat(user, "We have regenerated.") diff --git a/code/game/gamemodes/cult/cult_structures.dm b/code/game/gamemodes/cult/cult_structures.dm index 84941f4d7a7..63e0626f481 100644 --- a/code/game/gamemodes/cult/cult_structures.dm +++ b/code/game/gamemodes/cult/cult_structures.dm @@ -210,9 +210,7 @@ var/list/blacklisted_pylon_turfs = typecacheof(list( if(L.health != L.maxHealth) new /obj/effect/temp_visual/heal(get_turf(src), "#960000") if(ishuman(L)) - L.adjustBruteLoss(-1) - L.adjustFireLoss(-1) - L.updatehealth() + L.heal_overall_damage(1, 1) if(istype(L, /mob/living/simple_animal/shade) || istype(L, /mob/living/simple_animal/hostile/construct)) var/mob/living/simple_animal/M = L if(M.health < M.maxHealth) diff --git a/code/game/gamemodes/miniantags/borer/borer.dm b/code/game/gamemodes/miniantags/borer/borer.dm index 45998cd4b30..a0ccbad7ab6 100644 --- a/code/game/gamemodes/miniantags/borer/borer.dm +++ b/code/game/gamemodes/miniantags/borer/borer.dm @@ -42,7 +42,7 @@ to_chat(src, "You begin doggedly resisting the parasite's control (this will take approximately sixty seconds).") to_chat(B.host, "You feel the captive mind of [src] begin to resist your control.") - var/delay = (rand(350,450) + B.host.brainloss) + var/delay = (rand(350,450) + B.host.getBrainLoss()) addtimer(CALLBACK(src, .proc/return_control, B), delay) diff --git a/code/game/gamemodes/miniantags/guardian/guardian.dm b/code/game/gamemodes/miniantags/guardian/guardian.dm index 9465d479f02..449e5f5ae3a 100644 --- a/code/game/gamemodes/miniantags/guardian/guardian.dm +++ b/code/game/gamemodes/miniantags/guardian/guardian.dm @@ -90,7 +90,10 @@ snapback() /mob/living/simple_animal/hostile/guardian/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE to_chat(summoner, "Your [name] died somehow!") summoner.death() diff --git a/code/game/gamemodes/miniantags/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm index 693dbffbabb..94c39d12442 100644 --- a/code/game/gamemodes/miniantags/morph/morph.dm +++ b/code/game/gamemodes/miniantags/morph/morph.dm @@ -124,16 +124,19 @@ morph_time = world.time + MORPH_COOLDOWN /mob/living/simple_animal/hostile/morph/death(gibbed) - if(morphed) - visible_message("[src] twists and dissolves into a pile of green flesh!", \ - "Your skin ruptures! Your flesh breaks apart! No disguise can ward off de--") - restore() - if(gibbed) + . = ..() + if(stat == DEAD && gibbed) for(var/atom/movable/AM in src) AM.forceMove(loc) if(prob(90)) step(AM, pick(alldirs)) - ..(gibbed) + // Only execute the below if we successfully died + if(!.) + return FALSE + if(morphed) + visible_message("[src] twists and dissolves into a pile of green flesh!", \ + "Your skin ruptures! Your flesh breaks apart! No disguise can ward off de--") + restore() /mob/living/simple_animal/hostile/morph/Aggro() // automated only ..() diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index 953e6e91762..7d8953b8b84 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -161,15 +161,18 @@ /mob/living/simple_animal/revenant/dust() - death() + . = death() /mob/living/simple_animal/revenant/gib() - death() + . = death() /mob/living/simple_animal/revenant/death() - ..() if(!revealed) - return + return FALSE + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE ghost_darkness_images -= ghostimage updateallghostimages() @@ -190,7 +193,6 @@ R.client_to_revive = src.client //If the essence reforms, the old revenant is put back in the body ghostize() qdel(src) - return /mob/living/simple_animal/revenant/attackby(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/nullrod)) diff --git a/code/game/gamemodes/miniantags/slaughter/slaughter.dm b/code/game/gamemodes/miniantags/slaughter/slaughter.dm index 6b5705cfa7f..d6f14e546e5 100644 --- a/code/game/gamemodes/miniantags/slaughter/slaughter.dm +++ b/code/game/gamemodes/miniantags/slaughter/slaughter.dm @@ -96,10 +96,15 @@ desc = "A repulsive pile of guts and gore." /mob/living/simple_animal/slaughter/death(gibbed) + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE for(var/mob/living/M in consumed_mobs) - M.forceMove(get_turf(src)) - ..() + release_consumed(M) +/mob/living/simple_animal/slaughter/proc/release_consumed(mob/living/M) + M.forceMove(get_turf(src)) /mob/living/simple_animal/slaughter/phasein() . = ..() @@ -297,13 +302,12 @@ deathmessage = "fades out, as all of its friends are released from its prison of hugs." loot = list(/mob/living/simple_animal/pet/cat/kitten{name = "Laughter"}) -/mob/living/simple_animal/slaughter/laughter/death(gibbed) - for(var/mob/living/M in consumed_mobs) - if(M.revive()) - M.grab_ghost(force = TRUE) - playsound(get_turf(src), feast_sound, 50, 1, -1) - to_chat(M, "You leave the [src]'s warm embrace, and feel ready to take on the world.") - ..() +/mob/living/simple_animal/slaughter/laughter/release_consumed(mob/living/M) + if(M.revive()) + M.grab_ghost(force = TRUE) + playsound(get_turf(src), feast_sound, 50, 1, -1) + to_chat(M, "You leave the [src]'s warm embrace, and feel ready to take on the world.") + ..(M) //Objectives and helpers. @@ -345,4 +349,4 @@ ..() /datum/objective/demonFluff/check_completion() - return 1 \ No newline at end of file + return 1 diff --git a/code/game/gamemodes/shadowling/shadowling_abilities.dm b/code/game/gamemodes/shadowling/shadowling_abilities.dm index 43234e0c443..89c5f159108 100644 --- a/code/game/gamemodes/shadowling/shadowling_abilities.dm +++ b/code/game/gamemodes/shadowling/shadowling_abilities.dm @@ -493,18 +493,19 @@ metabolization_rate = 100 //lel /datum/reagent/shadowling_blindness_smoke/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(!is_shadow_or_thrall(M)) to_chat(M, "You breathe in the black smoke, and your eyes burn horribly!") - M.EyeBlind(5) + update_flags |= M.EyeBlind(5, FALSE) if(prob(25)) M.visible_message("[M] claws at [M.p_their()] eyes!") M.Stun(3) else to_chat(M, "You breathe in the black smoke, and you feel revitalized!") - M.heal_organ_damage(2,2) - M.adjustOxyLoss(-2) - M.adjustToxLoss(-2) - ..() + update_flags |= M.heal_organ_damage(2, 2, updating_health = FALSE) + update_flags |= M.adjustOxyLoss(-2, FALSE) + update_flags |= M.adjustToxLoss(-2, FALSE) + return ..() | update_flags /obj/effect/proc_holder/spell/aoe_turf/unearthly_screech name = "Sonic Screech" diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 798a01f2bda..295220d0077 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -264,9 +264,6 @@ maim_clone(H) H.Paralyse(4) - //Here let's calculate their health so the pod doesn't immediately eject them!!! - H.updatehealth() - if(grab_ghost_when == CLONER_FRESH_CLONE) clonemind.transfer_to(H) H.ckey = R.ckey @@ -555,7 +552,7 @@ qdel(i) missing_organs.Cut() - H.setCloneLoss(CLONE_INITIAL_DAMAGE) + H.setCloneLoss(CLONE_INITIAL_DAMAGE, FALSE) H.setBrainLoss(BRAIN_INITIAL_DAMAGE) for(var/o in H.internal_organs) @@ -578,6 +575,7 @@ missing_organs += I organs_number = LAZYLEN(missing_organs) + H.updatehealth() /obj/machinery/clonepod/proc/check_brine() // Clones are in a pickled bath of mild chemicals, keeping diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 44672d12461..22a376968d0 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -64,21 +64,19 @@ return 1 if(href_list["fix"]) - src.active = 1 - while(src.occupant.health < 100) - src.occupant.adjustOxyLoss(-1) - src.occupant.adjustFireLoss(-1) - src.occupant.adjustToxLoss(-1) - src.occupant.adjustBruteLoss(-1) - src.occupant.updatehealth() - if(src.occupant.health >= 0 && src.occupant.stat == 2) - src.occupant.stat = 0 - src.occupant.lying = 0 - dead_mob_list -= src.occupant - living_mob_list += src.occupant + active = 1 + while(occupant.health < 100) + occupant.adjustOxyLoss(-1, FALSE) + occupant.adjustFireLoss(-1, FALSE) + occupant.adjustToxLoss(-1, FALSE) + occupant.adjustBruteLoss(-1, FALSE) + occupant.updatehealth() + if(occupant.health >= 0 && occupant.stat == DEAD) + occupant.update_revive() + occupant.lying = 0 sleep(10) - src.active = 0 - src.add_fingerprint(usr) + active = 0 + add_fingerprint(usr) if(href_list["wireless"]) var/wireless = text2num(href_list["wireless"]) diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index a332e7df7c8..92e06641204 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -217,7 +217,7 @@ // Check if camera is accessible when jumping /obj/machinery/computer/security/proc/can_access_camera(var/obj/machinery/camera/C, var/mob/M) - if(CanUseTopic(M, default_state) != STATUS_INTERACTIVE || M.incapacitated() || M.blinded) + if(CanUseTopic(M, default_state) != STATUS_INTERACTIVE || M.incapacitated() || !M.has_vision()) return 0 if(isrobot(M)) @@ -361,4 +361,4 @@ icon_screen = "engie_cams" light_color = "#FAC54B" network = list("Power Alarms","Atmosphere Alarms","Fire Alarms") - circuit = /obj/item/circuitboard/camera/engineering \ No newline at end of file + circuit = /obj/item/circuitboard/camera/engineering diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index e4bdd652998..90ce57e880f 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -385,7 +385,7 @@ occupant.adjustToxLoss(max(-efficiency, (-20*(efficiency ** 2)) / occupant.getToxLoss())) var/heal_brute = occupant.getBruteLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getBruteLoss()) : 0 var/heal_fire = occupant.getFireLoss() ? min(efficiency, 20*(efficiency**2) / occupant.getFireLoss()) : 0 - occupant.heal_organ_damage(heal_brute,heal_fire) + occupant.heal_organ_damage(heal_brute, heal_fire) if(beaker && next_trans == 0) var/proportion = 10 * min(1/beaker.volume, 1) // Yes, this means you can get more bang for your buck with a beaker of SF vs a patch diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 7e3bafbdc39..f0e23d6c7d4 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -158,9 +158,7 @@ var/mob/living/silicon/robot/R = occupant restock_modules() if(repairs) - R.adjustBruteLoss(-(repairs)) - R.adjustFireLoss(-(repairs)) - R.updatehealth() + R.heal_overall_damage(repairs, repairs) if(R.cell) R.cell.charge = min(R.cell.charge + recharge_speed, R.cell.maxcharge) else if(istype(occupant, /mob/living/carbon/human)) @@ -168,8 +166,7 @@ if(H.get_int_organ(/obj/item/organ/internal/cell) && H.nutrition < 450) H.nutrition = min(H.nutrition+recharge_speed_nutrition, 450) if(repairs) - H.heal_overall_damage(repairs, repairs, 0, 1) - H.updatehealth() + H.heal_overall_damage(repairs, repairs, TRUE, 0, 1) /obj/machinery/recharge_station/proc/go_out() if(!occupant) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 5e99a954650..7078ba83561 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -62,7 +62,6 @@ playsound(src.loc, 'sound/items/Welder.ogg', 50, 1) H.emote("scream") // It is painful H.adjustBruteLoss(max(0, 80 - H.getBruteLoss())) // Hurt the human, don't try to kill them though. - H.handle_regular_hud_updates() // Make sure they see the pain. // Sleep for a couple of ticks to allow the human to see the pain sleep(5) diff --git a/code/game/mecha/equipment/tools/medical_tools.dm b/code/game/mecha/equipment/tools/medical_tools.dm index 9e3369f1af9..a8e854467a2 100644 --- a/code/game/mecha/equipment/tools/medical_tools.dm +++ b/code/game/mecha/equipment/tools/medical_tools.dm @@ -228,7 +228,6 @@ return if(M.health > 0) M.adjustOxyLoss(-1) - M.updatehealth() M.AdjustStunned(-4) M.AdjustWeakened(-4) M.AdjustStunned(-4) @@ -520,4 +519,3 @@ for(var/reagent in processed_reagents) reagents.add_reagent(reagent,amount) chassis.use_power(energy_drain) - diff --git a/code/game/mecha/equipment/tools/mining_tools.dm b/code/game/mecha/equipment/tools/mining_tools.dm index f39dedcc772..546bb6ae269 100644 --- a/code/game/mecha/equipment/tools/mining_tools.dm +++ b/code/game/mecha/equipment/tools/mining_tools.dm @@ -94,7 +94,6 @@ if(target) target.Paralyse(10) - target.updatehealth() /obj/item/mecha_parts/mecha_equipment/drill/diamonddrill diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 7706f3120f0..ca327fe6ef7 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -56,7 +56,6 @@ if(!M) return M.adjustOxyLoss(round(dam_force/2)) - M.updatehealth() target.visible_message("[chassis] squeezes [target].", \ "[chassis] squeezes [target].",\ "You hear something crack.") @@ -451,4 +450,3 @@ //NC.mergeConnectedNetworksOnTurf() last_piece = NC return 1 - diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 03b4f4adfaa..6957f70d2b2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -232,7 +232,6 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d var/obj/item/organ/external/affecting = H.get_organ("[user.hand ? "l" : "r" ]_arm") if(affecting && affecting.receive_damage(0, 5)) // 5 burn damage H.UpdateDamageIcon() - H.updatehealth() return else extinguish() @@ -554,4 +553,4 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d return TRUE /obj/item/attack_hulk(mob/living/carbon/human/user) - return FALSE \ No newline at end of file + return FALSE diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index 737abd10bb1..44a84ded883 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -90,7 +90,6 @@ to_chat(AI, "Your core files are being wiped!") while(AI && AI.stat != DEAD) AI.adjustOxyLoss(2) - AI.updatehealth() sleep(10) flush = 0 diff --git a/code/game/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 08e6ada170e..2c0f3cb1e70 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -302,14 +302,12 @@ if(cyborg.health < cyborg.maxHealth) if(cyborg.health < 0) - repair_amount = -2.5 + repair_amount = 2.5 powercost = 30 else - repair_amount = -1 + repair_amount = 1 powercost = 10 - cyborg.adjustBruteLoss(repair_amount) - cyborg.adjustFireLoss(repair_amount) - cyborg.updatehealth() + cyborg.heal_overall_damage(repair_amount, repair_amount) cyborg.cell.use(powercost) else cyborg.cell.use(5) diff --git a/code/game/objects/items/shooting_range.dm b/code/game/objects/items/shooting_range.dm index 300e08c5ef5..2a4a5a3fab1 100644 --- a/code/game/objects/items/shooting_range.dm +++ b/code/game/objects/items/shooting_range.dm @@ -94,9 +94,7 @@ hp -= Proj.damage if(hp <= 0) - for(var/mob/O in oviewers()) - if((O.client && !( O.blinded ))) - to_chat(O, "[src] breaks into tiny pieces and collapses!") + visible_message("[src] breaks into tiny pieces and collapses!") qdel(src) // Create a temporary object to represent the damage diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index 45059d3e80b..0bdc88c5b52 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -73,7 +73,6 @@ else M.heal_organ_damage(heal_brute, heal_burn) - M.updatehealth() user.visible_message("[user] applies [src] on [M].", \ "You apply [src] on [M].") use(1) diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index ec5ba4ef684..aaaa0dbc579 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -15,9 +15,7 @@ if(istype(M,/mob/living/silicon/robot)) //Repairing cyborgs var/mob/living/silicon/robot/R = M if(R.getBruteLoss() || R.getFireLoss() ) - R.adjustBruteLoss(-15) - R.adjustFireLoss(-15) - R.updatehealth() + R.heal_overall_damage(15, 15) use(1) user.visible_message("\The [user] applied some [src] at [R]'s damaged areas.",\ "You apply some [src] at [R]'s damaged areas.") @@ -31,7 +29,6 @@ if(S && S.is_robotic()) if(S.get_damage()) S.heal_damage(15, 15, robo_repair = 1) - H.updatehealth() use(1) user.visible_message("\The [user] applies some nanite paste at[user != M ? " \the [M]'s" : " \the"][S.name] with \the [src].",\ "You apply some nanite paste at [user == M ? "your" : "[M]'s"] [S.name].") diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index c37c1cce2c8..a1ae9b5485b 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -332,7 +332,6 @@ "[user] has touched [H.name] with [src]!") H.adjustStaminaLoss(50) H.Weaken(5) - H.updatehealth() //forces health update before next life tick playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1) H.emote("gasp") if(!H.undergoing_cardiac_arrest() && (prob(10) || defib.combat)) // Your heart explodes. @@ -479,7 +478,6 @@ "[user] has touched [H.name] with [src]!") H.adjustStaminaLoss(50) H.Weaken(5) - H.updatehealth() //forces health update before next life tick if(!H.undergoing_cardiac_arrest() && prob(10)) // Your heart explodes. H.set_heartattack(TRUE) playsound(get_turf(src), 'sound/machines/defib_zap.ogg', 50, 1, -1) diff --git a/code/game/objects/items/weapons/lighters.dm b/code/game/objects/items/weapons/lighters.dm index 94e97ea7c20..cca83a3917b 100644 --- a/code/game/objects/items/weapons/lighters.dm +++ b/code/game/objects/items/weapons/lighters.dm @@ -56,7 +56,6 @@ var/obj/item/organ/external/affecting = H.get_organ("[user.hand ? "l" : "r" ]_hand") if(affecting.receive_damage( 0, 5 )) //INFERNO H.UpdateDamageIcon() - H.updatehealth() user.visible_message("After a few attempts, [user] manages to light the [src], [user.p_they()] however burn[user.p_s()] [user.p_their()] finger in the process.") set_light(2) diff --git a/code/game/objects/items/weapons/shards.dm b/code/game/objects/items/weapons/shards.dm index 0f771fee03d..88de9de1b11 100644 --- a/code/game/objects/items/weapons/shards.dm +++ b/code/game/objects/items/weapons/shards.dm @@ -50,7 +50,6 @@ to_chat(H, "[src] cuts into your hand!") if(affecting.receive_damage(force*0.5)) H.UpdateDamageIcon() - H.updatehealth() /obj/item/shard/attackby(obj/item/I, mob/user, params) if(iswelder(I)) @@ -87,7 +86,6 @@ H.Weaken(3) if(affecting.receive_damage(5, 0)) H.UpdateDamageIcon() - H.updatehealth() ..() /obj/item/shard/plasma @@ -126,4 +124,4 @@ to_chat(usr, "You add the newly-formed plasma glass to the stack. It now contains [NG.amount] sheets.") qdel(src) else - return ..() \ No newline at end of file + return ..() diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 00860477833..f74a3b542ca 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -147,7 +147,6 @@ H.adjustBruteLoss(damage) H.UpdateDamageIcon() - H.updatehealth() return /obj/structure/proc/can_touch(var/mob/user) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index 646adc30551..acf70b8aa7c 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -60,9 +60,7 @@ if(allowed(user)) locked = !locked playsound(loc, 'sound/machines/click.ogg', 15, 1, -3) - for(var/mob/O in viewers(user, 3)) - if((O.client && !( O.blinded ))) - to_chat(O, "The locker has been [locked ? null : "un"]locked by [user].") + visible_message("The locker has been [locked ? null : "un"]locked by [user].") update_icon() else to_chat(user, "Access Denied") diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index b3530156d91..26b3e53362e 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -270,9 +270,7 @@ return if(src.allowed(user)) src.locked = !src.locked - for(var/mob/O in viewers(user, 3)) - if((O.client && !( O.blinded ))) - to_chat(O, "The crate has been [locked ? null : "un"]locked by [user].") + visible_message("The crate has been [locked ? null : "un"]locked by [user].") update_icon() else to_chat(user, "Access Denied") diff --git a/code/game/objects/structures/lamarr_cage.dm b/code/game/objects/structures/lamarr_cage.dm index 03182f69547..7fa0357cfaf 100644 --- a/code/game/objects/structures/lamarr_cage.dm +++ b/code/game/objects/structures/lamarr_cage.dm @@ -69,10 +69,7 @@ if(src.destroyed) return else - to_chat(usr, text("You kick the lab cage.")) - for(var/mob/O in oviewers()) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] kicks the lab cage.", usr)) + user.visible_message("[user] kicks the lab cage.", "You kick the lab cage.") src.health -= 2 healthcheck() return @@ -82,4 +79,4 @@ new /obj/item/clothing/mask/facehugger/lamarr(src.loc) occupied = 0 update_icon() - return \ No newline at end of file + return diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 60ca03ad0f7..968fcef2fd5 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -207,9 +207,7 @@ return O.forceMove(loc) if(user != O) - for(var/mob/B in viewers(user, 3)) - if((B.client && !( B.blinded ))) - to_chat(B, text("[] stuffs [] into []!", user, O, src)) + user.visible_message("[user] stuffs [O] into [src]!") return /obj/structure/m_tray/Destroy() @@ -440,9 +438,7 @@ return O.forceMove(loc) if(user != O) - for(var/mob/B in viewers(user, 3)) - if((B.client && !( B.blinded ))) - to_chat(B, text("[] stuffs [] into []!", user, O, src)) + user.visible_message("[user] stuffs [O] into [src]!") //Foreach goto(99) return diff --git a/code/game/verbs/suicide.dm b/code/game/verbs/suicide.dm index 59f50797cf1..06b168da042 100644 --- a/code/game/verbs/suicide.dm +++ b/code/game/verbs/suicide.dm @@ -24,24 +24,24 @@ //Do dmgamt damage divided by the number of damage types applied. if(damagetype & BRUTELOSS) - adjustBruteLoss(dmgamt / damage_mod) + adjustBruteLoss(dmgamt / damage_mod, FALSE) if(damagetype & FIRELOSS) - adjustFireLoss(dmgamt / damage_mod) + adjustFireLoss(dmgamt / damage_mod, FALSE) if(damagetype & TOXLOSS) - adjustToxLoss(dmgamt / damage_mod) + adjustToxLoss(dmgamt / damage_mod, FALSE) if(damagetype & OXYLOSS) - adjustOxyLoss(dmgamt / damage_mod) + adjustOxyLoss(dmgamt / damage_mod, FALSE) // Failing that... if(!(damagetype & BRUTELOSS) && !(damagetype & FIRELOSS) && !(damagetype & TOXLOSS) && !(damagetype & OXYLOSS)) if(NO_BREATHE in dna.species.species_traits) // the ultimate fallback - take_overall_damage(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0), 0) + take_overall_damage(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0), 0, updating_health = FALSE) else - adjustOxyLoss(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) + adjustOxyLoss(max(dmgamt - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0), FALSE) var/obj/item/organ/external/affected = get_organ("head") if(affected) @@ -87,8 +87,6 @@ to_chat(viewers(src), "[src] [replacetext(pick(dna.species.suicide_messages), "their", p_their())] It looks like [p_theyre()] trying to commit suicide.") do_suicide(0) - updatehealth() - /mob/living/carbon/brain/verb/suicide() set hidden = 1 @@ -132,7 +130,6 @@ to_chat(viewers(src), "[src] is powering down. It looks like [p_theyre()] trying to commit suicide.") //put em at -175 adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) - updatehealth() /mob/living/silicon/robot/verb/suicide() set hidden = 1 @@ -152,7 +149,6 @@ to_chat(viewers(src), "[src] is powering down. It looks like [p_theyre()] trying to commit suicide.") //put em at -175 adjustOxyLoss(max(maxHealth * 2 - getToxLoss() - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) - updatehealth() /mob/living/silicon/pai/verb/suicide() set category = "pAI Commands" @@ -189,7 +185,6 @@ to_chat(viewers(src), "[src] is thrashing wildly! It looks like [p_theyre()] trying to commit suicide.") //put em at -175 adjustOxyLoss(max(175 - getFireLoss() - getBruteLoss() - getOxyLoss(), 0)) - updatehealth() /mob/living/carbon/slime/verb/suicide() @@ -206,9 +201,9 @@ if(confirm == "Yes") suiciding = 1 - setOxyLoss(100) - adjustBruteLoss(100 - getBruteLoss()) - setToxLoss(100) - setCloneLoss(100) + setOxyLoss(100, FALSE) + adjustBruteLoss(100 - getBruteLoss(), FALSE) + setToxLoss(100, FALSE) + setCloneLoss(100, FALSE) updatehealth() diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index 5d6aa7490e2..011e46e7990 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -54,7 +54,6 @@ H.Stun(3) if(affecting) affecting.receive_damage(1, 0) - H.updatehealth() else if(ismouse(target)) var/mob/living/simple_animal/mouse/M = target visible_message("SPLAT!") diff --git a/code/modules/awaymissions/mission_code/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm index 9ebd1d88b6b..90d27fbf7ed 100644 --- a/code/modules/awaymissions/mission_code/wildwest.dm +++ b/code/modules/awaymissions/mission_code/wildwest.dm @@ -262,8 +262,9 @@ return list() /mob/living/simple_animal/hostile/syndicate/ranged/wildwest/death(gibbed) - if(!on_alert) + // putting this up here so we don't say anything after deathgasp + if(can_die() && !on_alert) say("How could you betray the Syndicate?") for(var/mob/living/simple_animal/hostile/syndicate/ranged/wildwest/W in living_mob_list) W.on_alert = TRUE - ..(gibbed) + return ..(gibbed) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 74a0baf8cd5..2f0032d619f 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -301,7 +301,7 @@ Gunshots/explosions/opening doors/less rare audio (done) if(bubblegum.Adjacent(target) && !charged) charged = TRUE target.Weaken(4) - target.staminaloss += 40 + target.adjustStaminaLoss(40) step_away(target, bubblegum) shake_camera(target, 4, 3) target.visible_message("[target] jumps backwards, falling on the ground!","[bubblegum] slams into you!") @@ -637,7 +637,7 @@ Gunshots/explosions/opening doors/less rare audio (done) if(weapon_name) my_target.playsound_local(my_target, weap.hitsound, 1) my_target.show_message("[src.name] has attacked [my_target] with [weapon_name]!", 1) - my_target.staminaloss += 30 + my_target.adjustStaminaLoss(30) if(prob(20)) my_target.AdjustEyeBlurry(3) if(prob(33)) @@ -646,7 +646,7 @@ Gunshots/explosions/opening doors/less rare audio (done) else my_target.playsound_local(my_target, pick('sound/weapons/punch1.ogg','sound/weapons/punch2.ogg','sound/weapons/punch3.ogg','sound/weapons/punch4.ogg'), 25, 1, -1) my_target.show_message("[src.name] has punched [my_target]!", 1) - my_target.staminaloss += 30 + my_target.adjustStaminaLoss(30) if(prob(33)) if(!locate(/obj/effect/overlay) in my_target.loc) fake_blood(my_target) diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 16464aff11c..32671d598c9 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -92,12 +92,14 @@ ..() /mob/living/simple_animal/hostile/mining_drone/death() - ..() + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE visible_message("[src] is destroyed!") new /obj/effect/decal/cleanable/blood/gibs/robot(src.loc) DropOre(0) qdel(src) - return /mob/living/simple_animal/hostile/mining_drone/attack_hand(mob/living/carbon/human/M) if(M.a_intent == INTENT_HELP) @@ -307,4 +309,4 @@ origin_tech = "programming=6" #undef MINEDRONE_COLLECT -#undef MINEDRONE_ATTACK \ No newline at end of file +#undef MINEDRONE_ATTACK diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f20ba3b734d..83718395e68 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -12,7 +12,6 @@ var/list/image/ghost_darkness_images = list() //this is a list of images for thi stat = DEAD density = 0 canmove = 0 - blinded = 0 anchored = 1 // don't get pushed around invisibility = INVISIBILITY_OBSERVER var/can_reenter_corpse diff --git a/code/modules/mob/death.dm b/code/modules/mob/death.dm index cf3e4c320b5..e9ef1f37b93 100644 --- a/code/modules/mob/death.dm +++ b/code/modules/mob/death.dm @@ -1,94 +1,12 @@ -//This is the proc for gibbing a mob. Cannot gib ghosts. -//added different sort of gibs and animations. N +// can't die if you're not alive /mob/proc/gib() - death(1) - var/atom/movable/overlay/animation = null - notransform = 1 - canmove = 0 - icon = null - invisibility = 101 + return FALSE - playsound(src.loc, 'sound/goonstation/effects/gib.ogg', 50, 1) - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("gibbed-m", animation) - gibs(loc, dna) - dead_mob_list -= src - if(client) - respawnable_list += src - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) - - -//This is the proc for turning a mob into ash. Mostly a copy of gib code (above). -//Originally created for wizard disintegrate. I've removed the virus code since it's irrelevant here. -//Dusting robots does not eject the MMI, so it's a bit more powerful than gib() /N /mob/proc/dust() - death(1) - var/atom/movable/overlay/animation = null - notransform = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("dust-m", animation) - new /obj/effect/decal/cleanable/ash(loc) - - dead_mob_list -= src - if(client) - respawnable_list += src - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + return FALSE /mob/proc/melt() - death(1) - var/atom/movable/overlay/animation = null - notransform = 1 - canmove = 0 - icon = null - invisibility = 101 - - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("liquify", animation) -// new /obj/effect/decal/cleanable/ash(loc) - - dead_mob_list -= src - if(client) - respawnable_list += src - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + return FALSE /mob/proc/death(gibbed) - - //Makes it so gib/dust/melt all unbuckle their victims from anything they may be buckled to to avoid breaking beds/chairs/etc - if(gibbed && buckled) - buckled.unbuckle_mob() - - //Quick fix for corpses kept propped up in chairs. ~Z - drop_r_hand() - drop_l_hand() - //End of fix. - - timeofdeath = world.time - - living_mob_list -= src - dead_mob_list += src - if(client) - respawnable_list += src - return ..(gibbed) + return FALSE diff --git a/code/modules/mob/hear_say.dm b/code/modules/mob/hear_say.dm index 6c11ee7a3a4..2593d2eebaf 100644 --- a/code/modules/mob/hear_say.dm +++ b/code/modules/mob/hear_say.dm @@ -28,7 +28,7 @@ //non-verbal languages are garbled if you can't see the speaker. Yes, this includes if they are inside a closet. if(language && (language.flags & NONVERBAL)) - if(!has_vision()) //blind people can't see dumbass + if(!has_vision(information_only = TRUE)) //blind people can't see dumbass message = stars(message) if(!speaker || !(speaker in view(src))) @@ -95,7 +95,7 @@ //non-verbal languages are garbled if you can't see the speaker. Yes, this includes if they are inside a closet. if(language && (language.flags & NONVERBAL)) - if(!has_vision()) //blind people can't see dumbass + if(!has_vision(information_only=TRUE)) //blind people can't see dumbass message = stars(message) if(!speaker || !(speaker in view(src))) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 8f74fbce413..7d2b92b1d14 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -19,6 +19,8 @@ var/leaping = 0 ventcrawler = 2 var/list/alien_organs = list() + var/death_message = "lets out a waning guttural screech, green blood bubbling from its maw..." + var/death_sound = 'sound/voice/hiss6.ogg' /mob/living/carbon/alien/New() verbs += /mob/living/verb/mob_sleep @@ -49,25 +51,25 @@ /mob/living/carbon/alien/adjustToxLoss(amount) - return + return STATUS_UPDATE_NONE /mob/living/carbon/alien/adjustFireLoss(amount) // Weak to Fire if(amount > 0) - ..(amount * 2) + return ..(amount * 2) else - ..(amount) - return + return ..(amount) /mob/living/carbon/alien/check_eye_prot() return 2 -/mob/living/carbon/alien/updatehealth() +/mob/living/carbon/alien/updatehealth(reason = "none given") if(status_flags & GODMODE) health = maxHealth stat = CONSCIOUS return health = maxHealth - getOxyLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() + update_stat("updatehealth([reason])") /mob/living/carbon/alien/handle_environment(var/datum/gas_mixture/environment) @@ -256,4 +258,4 @@ Des: Removes all infected images from the alien. if(getBruteLoss() < 200) return pick("xltrails_1", "xltrails_2") else - return pick("xttrails_1", "xttrails_2") \ No newline at end of file + return pick("xttrails_1", "xttrails_2") diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index 72bf30ceedf..9e29acd9282 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -36,7 +36,6 @@ In all, this is a lot like the monkey code. /N "[M.name] bites [src]!") adjustBruteLoss(damage) add_attack_logs(M, src, "Alien attack", ATKLOG_ALL) - updatehealth() else to_chat(M, "[name] is too injured for that.") @@ -75,4 +74,3 @@ In all, this is a lot like the monkey code. /N adjustCloneLoss(damage) if(STAMINA) adjustStaminaLoss(damage) - updatehealth() diff --git a/code/modules/mob/living/carbon/alien/death.dm b/code/modules/mob/living/carbon/alien/death.dm index 6d663d6f3d4..e8982bb89e6 100644 --- a/code/modules/mob/living/carbon/alien/death.dm +++ b/code/modules/mob/living/carbon/alien/death.dm @@ -43,18 +43,15 @@ if(src) qdel(src) /mob/living/carbon/alien/death(gibbed) - if(stat == DEAD) return - if(healths) healths.icon_state = "health6" - stat = DEAD + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE + if(healths) + healths.icon_state = "health6" if(!gibbed) - playsound(loc, 'sound/voice/hiss6.ogg', 80, 1, 1) - for(var/mob/O in viewers(src, null)) - O.show_message("[src] lets out a waning guttural screech, green blood bubbling from its maw...", 1) - update_canmove() + if(death_sound) + playsound(loc, death_sound, 80, 1, 1) + visible_message("[src] [death_message]") update_icons() - - timeofdeath = world.time - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) - - return ..(gibbed) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 8946189b4cb..da47f8c80b5 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -73,10 +73,7 @@ AdjustEarDamage(15) AdjustEarDeaf(60) - adjustBruteLoss(b_loss) - adjustFireLoss(f_loss) - - updatehealth() + take_overall_damage(b_loss, f_loss) /mob/living/carbon/alien/humanoid/attack_slime(mob/living/carbon/slime/M) ..() @@ -85,7 +82,6 @@ damage = rand(10, 40) adjustBruteLoss(damage) add_attack_logs(src, M, "Slime'd for [damage] damage") - updatehealth() return /mob/living/carbon/alien/humanoid/restrained() diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index 3fa08702605..cef087f343c 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -30,7 +30,6 @@ "You hear someone fall.") adjustBruteLoss(damage) add_attack_logs(M, src, "Melee attacked with fists") - updatehealth() else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to punch [src]!") @@ -56,4 +55,4 @@ /mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect, end_pixel_y) if(!no_effect && !visual_effect_icon) visual_effect_icon = ATTACK_EFFECT_CLAW - ..() \ No newline at end of file + ..() diff --git a/code/modules/mob/living/carbon/alien/humanoid/life.dm b/code/modules/mob/living/carbon/alien/humanoid/life.dm index 180d6bd8072..7771f1f5f90 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/life.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/life.dm @@ -44,12 +44,10 @@ updatehealth() if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP - blinded = 1 SetSilence(0) else //ALIVE. LIGHTS ARE ON if(health < config.health_threshold_dead || !get_int_organ(/obj/item/organ/internal/brain)) death() - blinded = 1 SetSilence(0) return 1 @@ -62,10 +60,8 @@ Paralyse(3) if(paralysis) - blinded = 1 stat = UNCONSCIOUS else if(sleeping) - blinded = 1 stat = UNCONSCIOUS if(prob(10) && health) emote("hiss") @@ -77,12 +73,8 @@ if(move_delay_add > 0) move_delay_add = max(0, move_delay_add - rand(1, 2)) - //Eyes - if(disabilities & BLIND) //disabled-blind, doesn't get better on its own - blinded = 1 - else if(eye_blind) //blindness, heals slowly over time + if(eye_blind) //blindness, heals slowly over time AdjustEyeBlind(-1) - blinded = 1 else if(eye_blurry) //blurry eyes heal slowly AdjustEyeBlurry(-1) diff --git a/code/modules/mob/living/carbon/alien/larva/death.dm b/code/modules/mob/living/carbon/alien/larva/death.dm deleted file mode 100644 index 7d1101ca7d8..00000000000 --- a/code/modules/mob/living/carbon/alien/larva/death.dm +++ /dev/null @@ -1,15 +0,0 @@ -/mob/living/carbon/alien/larva/death(gibbed) - if(stat == DEAD) return - if(healths) healths.icon_state = "health6" - stat = DEAD - icon_state = "larva_dead" - - if(!gibbed) - visible_message("[src] lets out a waning high-pitched cry.") - update_canmove() - - timeofdeath = world.time - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) - living_mob_list -= src - - return ..(gibbed) diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 783d683f060..d0deac3e132 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -12,6 +12,8 @@ var/amount_grown = 0 var/max_grown = 200 var/time_of_birth + death_message = "lets out a waning high-pitched cry." + death_sound = null //This is fine right now, if we're adding organ specific damage this needs to be updated /mob/living/carbon/alien/larva/New() diff --git a/code/modules/mob/living/carbon/alien/larva/life.dm b/code/modules/mob/living/carbon/alien/larva/life.dm index 5bbb31c00d1..654e9e27af3 100644 --- a/code/modules/mob/living/carbon/alien/larva/life.dm +++ b/code/modules/mob/living/carbon/alien/larva/life.dm @@ -11,12 +11,10 @@ updatehealth() if(stat == DEAD) //DEAD. BROWN BREAD. SWIMMING WITH THE SPESS CARP - blinded = 1 SetSilence(0) else //ALIVE. LIGHTS ARE ON if(health < -25 || !get_int_organ(/obj/item/organ/internal/brain)) death() - blinded = 1 SetSilence(0) return 1 @@ -30,10 +28,8 @@ Paralyse(3) if(paralysis) - blinded = 1 stat = UNCONSCIOUS else if(sleeping) - blinded = 1 stat = UNCONSCIOUS if(prob(10) && health) emote("hiss_") @@ -45,12 +41,8 @@ if(move_delay_add > 0) move_delay_add = max(0, move_delay_add - rand(1, 2)) - //Eyes - if(disabilities & BLIND) //disabled-blind, doesn't get better on its own - blinded = 1 - else if(eye_blind) //blindness, heals slowly over time + if(eye_blind) //blindness, heals slowly over time AdjustEyeBlind(-1) - blinded = 1 else if(eye_blurry) //blurry eyes heal slowly AdjustEyeBlurry(-1) diff --git a/code/modules/mob/living/carbon/alien/larva/powers.dm b/code/modules/mob/living/carbon/alien/larva/powers.dm index b3df2879f8f..f1076721cf1 100644 --- a/code/modules/mob/living/carbon/alien/larva/powers.dm +++ b/code/modules/mob/living/carbon/alien/larva/powers.dm @@ -9,16 +9,10 @@ if(layer != TURF_LAYER+0.2) layer = TURF_LAYER+0.2 - to_chat(src, text("You are now hiding.")) - for(var/mob/O in oviewers(src, null)) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] scurries to the ground!", src)) + visible_message("[src] scurries to the ground!", "You are now hiding.") else layer = MOB_LAYER - to_chat(src, text("You have stopped hiding.")) - for(var/mob/O in oviewers(src, null)) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] slowly peaks up from the ground...", src)) + visible_message("[src] slowly peeks up from the ground...", "You have stopped hiding.") /mob/living/carbon/alien/larva/verb/evolve() set name = "Evolve" diff --git a/code/modules/mob/living/carbon/brain/death.dm b/code/modules/mob/living/carbon/brain/death.dm index c38823173eb..777fce50423 100644 --- a/code/modules/mob/living/carbon/brain/death.dm +++ b/code/modules/mob/living/carbon/brain/death.dm @@ -1,42 +1,26 @@ /mob/living/carbon/brain/death(gibbed) - if(stat == DEAD) return + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE if(!gibbed && container && istype(container, /obj/item/mmi))//If not gibbed but in a container. - for(var/mob/O in viewers(container, null)) - O.show_message(text("[]'s MMI flatlines!", src), 1, "You hear something flatline.", 2) + visible_message("[src]'s MMI flatlines!", "You hear something flatline.") container.icon_state = "mmi_dead" - stat = DEAD - - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO - - timeofdeath = world.time - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) //mind. ? - - return ..(gibbed) /mob/living/carbon/brain/gib() - death(1) - var/atom/movable/overlay/animation = null + // can we muster a parent call here? + if(!death(TRUE) && stat != DEAD) + return FALSE notransform = 1 canmove = 0 icon = null invisibility = 101 - animation = new(loc) - animation.icon_state = "blank" - animation.icon = 'icons/mob/mob.dmi' - animation.master = src - -// flick("gibbed-m", animation) gibs(loc, dna) - dead_mob_list -= src if(container && istype(container, /obj/item/mmi)) qdel(container)//Gets rid of the MMI if there is one if(loc) if(istype(loc,/obj/item/organ/internal/brain)) qdel(loc)//Gets rid of the brain item - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + QDEL_IN(src, 0) diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index 757ccab9fb9..2ac3b3c4d6b 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -29,19 +29,12 @@ adjustFireLoss(5.0*discomfort) /mob/living/carbon/brain/handle_regular_status_updates() - updatehealth() + . = ..() - if(stat == DEAD) - blinded = 1 - SetSilence(0) - else + if(.) if(!container && (health < config.health_threshold_dead || ((world.time - timeofhostdeath) > config.revival_brain_life))) death() - blinded = 1 - SetSilence(0) - return 1 - - . = 1 + return 0 /mob/living/carbon/brain/breathe() return diff --git a/code/modules/mob/living/carbon/brain/update_status.dm b/code/modules/mob/living/carbon/brain/update_status.dm index 2532edfe37d..431d1eea0c3 100644 --- a/code/modules/mob/living/carbon/brain/update_status.dm +++ b/code/modules/mob/living/carbon/brain/update_status.dm @@ -1,8 +1,16 @@ -/mob/living/carbon/brain/update_stat() +/mob/living/carbon/brain/update_stat(reason = "none given") if(status_flags & GODMODE) return // if(health <= min_health) - if(health <= config.health_threshold_dead) - if(stat != DEAD) + if(stat == DEAD) + if(container && health > config.health_threshold_dead) + update_revive() + create_debug_log("revived, trigger reason: [reason]") + return + else + if(!container || health <= config.health_threshold_dead) + // Considered "dead" without any external apparatus death() + create_debug_log("died, trigger reason: [reason]") + return // Put brain(organ) damaging code here diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 8e4bfb95105..5b0adca02e5 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -60,7 +60,7 @@ if(organ.receive_damage(d, 0)) H.UpdateDamageIcon() - H.updatehealth() + H.updatehealth("stomach attack") else src.take_organ_damage(d) @@ -144,7 +144,7 @@ return 0 if(reagents.has_reagent("teslium")) shock_damage *= 1.5 //If the mob has teslium in their body, shocks are 50% more damaging! - take_overall_damage(0,shock_damage, used_weapon = "Electrocution") + take_overall_damage(0,shock_damage, TRUE, used_weapon = "Electrocution") visible_message( "[src] was shocked by \the [source]!", \ "You feel a powerful shock coursing through your body!", \ diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 5df7407ec71..e22b3b25445 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -55,9 +55,9 @@ var/stunprob = M.powerlevel * 7 + 10 if(prob(stunprob) && M.powerlevel >= 8) adjustFireLoss(M.powerlevel * rand(6,10)) - updatehealth() + updatehealth("slime attack") return 1 /mob/living/carbon/is_mouth_covered(head_only = FALSE, mask_only = FALSE) if((!mask_only && head && (head.flags_cover & HEADCOVERSMOUTH)) || (!head_only && wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH))) - return TRUE \ No newline at end of file + return TRUE diff --git a/code/modules/mob/living/carbon/death.dm b/code/modules/mob/living/carbon/death.dm index 2ad9b1ef6ab..8a06d1474a0 100644 --- a/code/modules/mob/living/carbon/death.dm +++ b/code/modules/mob/living/carbon/death.dm @@ -1,12 +1,11 @@ /mob/living/carbon/death(gibbed) - SetLoseBreath(0) - med_hud_set_health() - med_hud_set_status() + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE if(reagents) reagents.death_metabolize(src) for(var/obj/item/organ/internal/I in internal_organs) I.on_owner_death() - - ..(gibbed) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index bdca496d256..b2d2d24400b 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -1,5 +1,6 @@ /mob/living/carbon/human/gib() - death(1) + if(!death(TRUE) && stat != DEAD) + return FALSE var/atom/movable/overlay/animation = null notransform = 1 canmove = 0 @@ -43,13 +44,13 @@ var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread s.set_up(3, 1, src) s.start() - - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + QDEL_IN(animation, 15) + QDEL_IN(src, 0) + return TRUE /mob/living/carbon/human/dust() - death(1) + if(!death(TRUE) && stat != DEAD) + return FALSE var/atom/movable/overlay/animation = null notransform = 1 canmove = 0 @@ -63,13 +64,13 @@ flick("dust-h", animation) new dna.species.remains_type(get_turf(src)) - - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + QDEL_IN(src, 0) + QDEL_IN(animation, 15) + return TRUE /mob/living/carbon/human/melt() - death(1) + if(!death(TRUE) && stat != DEAD) + return FALSE var/atom/movable/overlay/animation = null notransform = 1 canmove = 0 @@ -82,60 +83,48 @@ animation.master = src flick("liquify", animation) + QDEL_IN(src, 0) + QDEL_IN(animation, 15) //new /obj/effect/decal/remains/human(loc) - - spawn(15) - if(animation) qdel(animation) - if(src) qdel(src) + return TRUE /mob/living/carbon/human/death(gibbed) - if(stat == DEAD) - return - if(healths) - healths.icon_state = "health5" - - if(!gibbed) + if(can_die() && !gibbed) emote("deathgasp") //let the world KNOW WE ARE DEAD - stat = DEAD - SetDizzy(0) - SetJitter(0) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE + set_heartattack(FALSE) - //Handle species-specific deaths. if(dna.species) + dna.species.handle_hud_icons(src) + //Handle species-specific deaths. dna.species.handle_death(src) - callHook("death", list(src, gibbed)) - if(ishuman(LAssailant)) var/mob/living/carbon/human/H=LAssailant if(H.mind) H.mind.kills += "[key_name(src)]" - if(!gibbed) - update_canmove() - - timeofdeath = world.time - med_hud_set_health() - med_hud_set_status() - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) if(ticker && ticker.mode) // log_world("k") sql_report_death(src) - ticker.mode.check_win() //Calls the rounds wincheck, mainly for wizard, malf, and changeling now if(wearing_rig) wearing_rig.notify_ai("Warning: user death event. Mobility control passed to integrated intelligence system.") - return ..(gibbed) - /mob/living/carbon/human/update_revive() . = ..() - // Update healthdoll if(. && healthdoll) // We're alive again, so re-build the entire healthdoll healthdoll.cached_healthdoll_overlays.Cut() + // Update healthdoll + if(dna.species) + dna.species.update_sight(src) + dna.species.handle_hud_icons(src) /mob/living/carbon/human/proc/makeSkeleton() var/obj/item/organ/external/head/H = get_organ("head") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d718e7e95d3..80ff83b7d21 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -294,7 +294,7 @@ if(prob(50) && !shielded) Paralyse(10) - take_overall_damage(b_loss,f_loss, used_weapon = "Explosive Blast") + take_overall_damage(b_loss,f_loss, TRUE, used_weapon = "Explosive Blast") ..() @@ -1598,7 +1598,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X if(H.health > config.health_threshold_dead && H.health <= config.health_threshold_crit) var/suff = min(H.getOxyLoss(), 7) H.adjustOxyLoss(-suff) - H.updatehealth() + H.updatehealth("cpr") visible_message("[src] performs CPR on [H.name]!", \ "You perform CPR on [H.name].") @@ -1867,4 +1867,4 @@ Eyes need to have significantly high darksight to shine unless the mob has the X /mob/living/carbon/human/proc/special_post_clone_handling() if(mind && mind.assigned_role == "Cluwne") //HUNKE your suffering never stops - makeCluwne() \ No newline at end of file + makeCluwne() diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm index ddfce48f6ce..d82fc719d88 100644 --- a/code/modules/mob/living/carbon/human/human_damage.dm +++ b/code/modules/mob/living/carbon/human/human_damage.dm @@ -1,5 +1,5 @@ //Updates the mob's health from organs and mob damage variables -/mob/living/carbon/human/updatehealth() +/mob/living/carbon/human/updatehealth(reason = "none given") if(status_flags & GODMODE) health = maxHealth stat = CONSCIOUS @@ -17,20 +17,14 @@ //TODO: fix husking if(((maxHealth - total_burn) < config.health_threshold_dead) && stat == DEAD) ChangeToHusk() - if(dna.species.can_revive_by_healing) - var/obj/item/organ/internal/brain/B = get_int_organ(/obj/item/organ/internal/brain) - if(B) - if((health >= (config.health_threshold_dead + config.health_threshold_crit) * 0.5) && stat == DEAD && getBrainLoss()<120) - update_revive() - if(stat == CONSCIOUS && (src in dead_mob_list)) //Defib fix - update_revive() + update_stat("updatehealth([reason])") med_hud_set_health() med_hud_set_status() - handle_hud_icons() + handle_hud_icons_health() -/mob/living/carbon/human/adjustBrainLoss(amount) +/mob/living/carbon/human/adjustBrainLoss(amount, updating = TRUE) if(status_flags & GODMODE) - return 0 //godmode + return STATUS_UPDATE_NONE //godmode if(dna.species && dna.species.has_organ["brain"]) var/obj/item/organ/internal/brain/sponge = get_int_organ(/obj/item/organ/internal/brain) @@ -38,15 +32,13 @@ if(dna.species) amount = amount * dna.species.brain_mod sponge.receive_damage(amount, 1) - brainloss = sponge.damage - else - brainloss = 200 - else - brainloss = 0 + if(updating) + update_stat("adjustBrainLoss") + return STATUS_UPDATE_STAT -/mob/living/carbon/human/setBrainLoss(amount) +/mob/living/carbon/human/setBrainLoss(amount, updating = TRUE) if(status_flags & GODMODE) - return 0 //godmode + return STATUS_UPDATE_NONE //godmode if(dna.species && dna.species.has_organ["brain"]) var/obj/item/organ/internal/brain/sponge = get_int_organ(/obj/item/organ/internal/brain) @@ -54,11 +46,9 @@ if(dna.species) amount = amount * dna.species.brain_mod sponge.damage = min(max(amount, 0), (maxHealth*2)) - brainloss = sponge.damage - else - brainloss = 200 - else - brainloss = 0 + if(updating) + update_stat("setBrainLoss") + return STATUS_UPDATE_STAT /mob/living/carbon/human/getBrainLoss() if(status_flags & GODMODE) @@ -67,12 +57,11 @@ if(dna.species && dna.species.has_organ["brain"]) var/obj/item/organ/internal/brain/sponge = get_int_organ(/obj/item/organ/internal/brain) if(sponge) - brainloss = min(sponge.damage,maxHealth*2) + return min(sponge.damage,maxHealth*2) else - brainloss = 200 + return 200 else - brainloss = 0 - return brainloss + return 0 //These procs fetch a cumulative total damage from all organs /mob/living/carbon/human/getBruteLoss() @@ -88,23 +77,27 @@ return amount -/mob/living/carbon/human/adjustBruteLoss(amount, damage_source, robotic=0) +/mob/living/carbon/human/adjustBruteLoss(amount, updating_health = TRUE, damage_source = null, robotic = FALSE) if(dna.species) amount = amount * dna.species.brute_mod if(amount > 0) - take_overall_damage(amount, 0, used_weapon = damage_source) + take_overall_damage(amount, 0, updating_health, used_weapon = damage_source) else - heal_overall_damage(-amount, 0, 0, robotic) + heal_overall_damage(-amount, 0, updating_health, FALSE, robotic) + // brainless default for now + return STATUS_UPDATE_HEALTH -/mob/living/carbon/human/adjustFireLoss(amount, damage_source, robotic=0) +/mob/living/carbon/human/adjustFireLoss(amount, updating_health = TRUE, damage_source = null, robotic = FALSE) if(dna.species) amount = amount * dna.species.burn_mod if(amount > 0) - take_overall_damage(0, amount, used_weapon = damage_source) + take_overall_damage(0, amount, updating_health, used_weapon = damage_source) else - heal_overall_damage(0, -amount, 0, robotic) + heal_overall_damage(0, -amount, updating_health, FALSE, robotic) + // brainless default for now + return STATUS_UPDATE_HEALTH -/mob/living/carbon/human/proc/adjustBruteLossByPart(amount, organ_name, obj/damage_source = null) +/mob/living/carbon/human/proc/adjustBruteLossByPart(amount, organ_name, obj/damage_source = null, updating_health = TRUE) if(dna.species) amount = amount * dna.species.brute_mod @@ -112,13 +105,14 @@ var/obj/item/organ/external/O = get_organ(organ_name) if(amount > 0) - O.receive_damage(amount, 0, sharp=is_sharp(damage_source), used_weapon=damage_source) + O.receive_damage(amount, 0, sharp=is_sharp(damage_source), used_weapon=damage_source, list(), FALSE, updating_health) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. - O.heal_damage(-amount, 0, internal = 0, robo_repair = O.is_robotic()) + O.heal_damage(-amount, 0, internal = 0, robo_repair = O.is_robotic(), updating_health = updating_health) + return STATUS_UPDATE_HEALTH -/mob/living/carbon/human/proc/adjustFireLossByPart(amount, organ_name, obj/damage_source = null) +/mob/living/carbon/human/proc/adjustFireLossByPart(amount, organ_name, obj/damage_source = null, updating_health = TRUE) if(dna.species) amount = amount * dna.species.burn_mod @@ -126,22 +120,23 @@ var/obj/item/organ/external/O = get_organ(organ_name) if(amount > 0) - O.receive_damage(0, amount, sharp=is_sharp(damage_source), used_weapon=damage_source) + O.receive_damage(0, amount, sharp=is_sharp(damage_source), used_weapon=damage_source, forbidden_limbs = list(), ignore_resists = FALSE, updating_health = updating_health) else //if you don't want to heal robot organs, they you will have to check that yourself before using this proc. - O.heal_damage(0, -amount, internal = 0, robo_repair = O.is_robotic()) + O.heal_damage(0, -amount, internal = 0, robo_repair = O.is_robotic(), updating_health = updating_health) + return STATUS_UPDATE_HEALTH /mob/living/carbon/human/Paralyse(amount) // Notify our AI if they can now control the suit. if(wearing_rig && !stat && paralysis < amount) //We are passing out right this second. wearing_rig.notify_ai("Warning: user consciousness failure. Mobility control passed to integrated intelligence system.") - ..() + return ..() /mob/living/carbon/human/adjustCloneLoss(amount) if(dna.species) amount = amount * dna.species.clone_mod - ..() + . = ..() var/heal_prob = max(0, 80 - getCloneLoss()) var/mut_prob = min(80, getCloneLoss() + 10) @@ -181,22 +176,22 @@ /mob/living/carbon/human/adjustOxyLoss(amount) if(dna.species) amount = amount * dna.species.oxy_mod - ..() + . = ..() /mob/living/carbon/human/setOxyLoss(amount) if(dna.species) amount = amount * dna.species.oxy_mod - ..() + . = ..() /mob/living/carbon/human/adjustToxLoss(amount) if(dna.species) amount = amount * dna.species.tox_mod - ..() + . = ..() /mob/living/carbon/human/setToxLoss(amount) if(dna.species) amount = amount * dna.species.tox_mod - ..() + . = ..() //////////////////////////////////////////// @@ -223,31 +218,29 @@ //Heals ONE external organ, organ gets randomly selected from damaged ones. //It automatically updates damage overlays if necesary //It automatically updates health status -/mob/living/carbon/human/heal_organ_damage(brute, burn) +/mob/living/carbon/human/heal_organ_damage(brute, burn, updating_health = TRUE) var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn) if(!parts.len) return var/obj/item/organ/external/picked = pick(parts) - if(picked.heal_damage(brute,burn)) + if(picked.heal_damage(brute,burn, updating_health)) UpdateDamageIcon() - updatehealth() //Damages ONE external organ, organ gets randomly selected from damagable ones. //It automatically updates damage overlays if necesary //It automatically updates health status -/mob/living/carbon/human/take_organ_damage(brute, burn, sharp = 0, edge = 0) +/mob/living/carbon/human/take_organ_damage(brute, burn, updating_health = TRUE, sharp = 0, edge = 0) var/list/obj/item/organ/external/parts = get_damageable_organs() if(!parts.len) return var/obj/item/organ/external/picked = pick(parts) - if(picked.receive_damage(brute, burn, sharp)) + if(picked.receive_damage(brute, burn, sharp, updating_health)) UpdateDamageIcon() - updatehealth() speech_problem_flag = 1 //Heal MANY external organs, in random order -/mob/living/carbon/human/heal_overall_damage(brute, burn, internal=0, robotic=0) +/mob/living/carbon/human/heal_overall_damage(brute, burn, updating_health = TRUE, internal=0, robotic=0) var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn) var/update = 0 @@ -257,20 +250,21 @@ var/brute_was = picked.brute_dam var/burn_was = picked.burn_dam - update |= picked.heal_damage(brute,burn, internal, robotic) + update |= picked.heal_damage(brute,burn, internal, robotic, updating_health = FALSE) brute -= (brute_was-picked.brute_dam) burn -= (burn_was-picked.burn_dam) parts -= picked - updatehealth() + if(updating_health) + updatehealth("heal overall damage") speech_problem_flag = 1 if(update) UpdateDamageIcon() // damage MANY external organs, in random order -/mob/living/carbon/human/take_overall_damage(brute, burn, sharp = 0, edge = 0, used_weapon = null) +/mob/living/carbon/human/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null, sharp = 0, edge = 0) if(status_flags & GODMODE) return //godmode var/list/obj/item/organ/external/parts = get_damageable_organs() @@ -285,14 +279,15 @@ var/burn_was = picked.burn_dam - update |= picked.receive_damage(brute_per_part, burn_per_part, sharp, used_weapon) + update |= picked.receive_damage(brute_per_part, burn_per_part, sharp, used_weapon, list(), FALSE, FALSE) brute -= (picked.brute_dam - brute_was) burn -= (picked.burn_dam - burn_was) parts -= picked - updatehealth() + if(updating_health) + updatehealth("take overall damage") if(update) UpdateDamageIcon() @@ -364,7 +359,7 @@ This function restores all organs. var/list/attack_bubble_recipients = list() var/mob/living/user for(var/mob/O in viewers(user, src)) - if(O.client && !(O.blinded)) + if(O.client && O.has_vision(information_only=TRUE)) attack_bubble_recipients.Add(O.client) spawn(0) var/image/dmgIcon = image('icons/effects/hit_blips.dmi', src, "dmg[rand(1,2)]",MOB_LAYER+1) @@ -383,5 +378,5 @@ This function restores all organs. UpdateDamageIcon() // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life(). - updatehealth() + updatehealth("apply damage") return 1 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index b8e209498c2..6e1d35fb0d2 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -375,7 +375,7 @@ emp_act var/obj/item/organ/external/affecting = get_organ(ran_zone(L.zone_sel.selecting)) var/armor_block = run_armor_check(affecting, "melee") apply_damage(damage, BRUTE, affecting, armor_block) - updatehealth() + updatehealth("larva attack") /mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M) if(check_shields(0, M.name)) @@ -404,7 +404,7 @@ emp_act "[M] has wounded [src]!") apply_effect(4, WEAKEN, armor_block) add_attack_logs(M, src, "Alien attacked") - updatehealth() + updatehealth("alien attack") if(M.a_intent == INTENT_DISARM) if(prob(80)) @@ -434,7 +434,7 @@ emp_act if(affected) affected.add_autopsy_data(M.name, damage) // Add the mob's name to the autopsy data apply_damage(damage, M.melee_damage_type, affecting, armor) - updatehealth() + updatehealth("animal attack") /mob/living/carbon/human/attack_slime(mob/living/carbon/slime/M) ..() @@ -473,7 +473,7 @@ emp_act M.mech_toxin_damage(src) else return - updatehealth() + updatehealth("mech melee attack") M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].", \ @@ -502,4 +502,4 @@ emp_act if(check_head && head && (head.flags_cover & HEADCOVERSEYES)) return TRUE if(check_mask && wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH)) - return TRUE \ No newline at end of file + return TRUE diff --git a/code/modules/mob/living/carbon/human/interactive/interactive.dm b/code/modules/mob/living/carbon/human/interactive/interactive.dm index d8d469cfd57..3e75d79b645 100644 --- a/code/modules/mob/living/carbon/human/interactive/interactive.dm +++ b/code/modules/mob/living/carbon/human/interactive/interactive.dm @@ -578,8 +578,11 @@ return get_dist(get_turf(towhere), get_turf(src)) /mob/living/carbon/human/interactive/death() + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE saveVoice() - ..() /mob/living/carbon/human/interactive/hear_say(message, verb = "says", datum/language/language = null, italics = 0, mob/speaker = null, sound/speech_sound, sound_vol) if(!istype(speaker, /mob/living/carbon/human/interactive)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index d577a02e2c4..11df45462c4 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -144,12 +144,12 @@ if(3) emote("drool") - if(getBrainLoss() >= 100 && stat != 2) //you lapse into a coma and die without immediate aid; RIP. -Fox + if(getBrainLoss() >= 100 && stat != DEAD) //you lapse into a coma and die without immediate aid; RIP. -Fox Weaken(20) AdjustLoseBreath(10) AdjustSilence(2) - if(getBrainLoss() >= 120 && stat != 2) //they died from stupidity--literally. -Fox + if(getBrainLoss() >= 120 && stat != DEAD) //they died from stupidity--literally. -Fox visible_message("[src] goes limp, [p_their()] facial expression utterly blank.") death() @@ -339,16 +339,16 @@ if(bodytemperature >= dna.species.heat_level_1 && bodytemperature <= dna.species.heat_level_2) throw_alert("temp", /obj/screen/alert/hot, 1) - take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_1, used_weapon = "High Body Temperature") + take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_1, updating_health = TRUE, used_weapon = "High Body Temperature") if(bodytemperature > dna.species.heat_level_2 && bodytemperature <= dna.species.heat_level_3) throw_alert("temp", /obj/screen/alert/hot, 2) - take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") + take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_2, updating_health = TRUE, used_weapon = "High Body Temperature") if(bodytemperature > dna.species.heat_level_3 && bodytemperature < INFINITY) throw_alert("temp", /obj/screen/alert/hot, 3) if(on_fire) - take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_3, used_weapon = "Fire") + take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_3, updating_health = TRUE, used_weapon = "Fire") else - take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_2, used_weapon = "High Body Temperature") + take_overall_damage(burn=mult*HEAT_DAMAGE_LEVEL_2, updating_health = TRUE, used_weapon = "High Body Temperature") else if(bodytemperature < dna.species.cold_level_1) if(status_flags & GODMODE) @@ -360,13 +360,13 @@ var/mult = dna.species.coldmod if(bodytemperature >= dna.species.cold_level_2 && bodytemperature <= dna.species.cold_level_1) throw_alert("temp", /obj/screen/alert/cold, 1) - take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_1, used_weapon = "Low Body Temperature") + take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_1, updating_health = TRUE, used_weapon = "Low Body Temperature") if(bodytemperature >= dna.species.cold_level_3 && bodytemperature < dna.species.cold_level_2) throw_alert("temp", /obj/screen/alert/cold, 2) - take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_2, used_weapon = "Low Body Temperature") + take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_2, updating_health = TRUE, used_weapon = "Low Body Temperature") if(bodytemperature > -INFINITY && bodytemperature < dna.species.cold_level_3) throw_alert("temp", /obj/screen/alert/cold, 3) - take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_3, used_weapon = "Low Body Temperature") + take_overall_damage(burn=mult*COLD_DAMAGE_LEVEL_3, updating_health = TRUE, used_weapon = "Low Body Temperature") else clear_alert("temp") else @@ -382,7 +382,7 @@ if(adjusted_pressure >= dna.species.hazard_high_pressure) if(!(HEATRES in mutations)) var/pressure_damage = min( ( (adjusted_pressure / dna.species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE) - take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure") + take_overall_damage(brute=pressure_damage, updating_health = TRUE, used_weapon = "High Pressure") throw_alert("pressure", /obj/screen/alert/highpressure, 2) else clear_alert("pressure") @@ -396,7 +396,7 @@ if(COLDRES in mutations) clear_alert("pressure") else - take_overall_damage(brute=LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure") + take_overall_damage(brute=LOW_PRESSURE_DAMAGE, updating_health = TRUE, used_weapon = "Low Pressure") throw_alert("pressure", /obj/screen/alert/lowpressure, 2) @@ -657,8 +657,6 @@ handle_trace_chems() - updatehealth() - return //TODO: DEFERRED /mob/living/carbon/human/handle_drunk() @@ -744,13 +742,11 @@ heal_overall_damage(0.1, 0.1) if(paralysis) - blinded = 1 stat = UNCONSCIOUS else if(sleeping) speech_problem_flag = 1 - blinded = 1 stat = UNCONSCIOUS if(mind) @@ -761,7 +757,6 @@ adjustToxLoss(-1) else if(status_flags & FAKEDEATH) - blinded = 1 stat = UNCONSCIOUS //Vision //god knows why this is here @@ -771,26 +766,21 @@ if(!dna.species.vision_organ) // Presumably if a species has no vision organs, they see via some other means. SetEyeBlind(0) - blinded = 0 SetEyeBlurry(0) else if(!vision || vision.is_broken()) // Vision organs cut out or broken? Permablind. EyeBlind(2) - blinded = 1 EyeBlurry(2) else //blindness if(disabilities & BLIND) // Disabled-blind, doesn't get better on its own - blinded = 1 else if(eye_blind) // Blindness, heals slowly over time AdjustEyeBlind(-1) - blinded = 1 else if(istype(glasses, /obj/item/clothing/glasses/sunglasses/blindfold)) //resting your eyes with a blindfold heals blurry eyes faster AdjustEyeBlurry(-3) - blinded = 1 //blurry sight if(vision.is_bruised()) // Vision organs impaired? Permablurry. @@ -826,7 +816,6 @@ else //dead - blinded = 1 SetSilence(0) @@ -860,11 +849,13 @@ remoteview_target = null reset_perspective(null) - dna.species.handle_vision(src) - /mob/living/carbon/human/handle_hud_icons() dna.species.handle_hud_icons(src) +/mob/living/carbon/human/handle_hud_icons_health() + dna.species.handle_hud_icons_health(src) + handle_hud_icons_health_overlay() + /mob/living/carbon/human/handle_random_events() // Puke if toxloss is too high if(!stat) diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index cb1d9b55319..ea6abc3a65c 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -504,43 +504,23 @@ /datum/species/proc/handle_can_equip(obj/item/I, slot, disable_warning = 0, mob/living/carbon/human/user) return FALSE -/datum/species/proc/handle_vision(mob/living/carbon/human/H) - // Right now this just handles blind, blurry, and similar states - if(H.blinded || H.eye_blind) - H.overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - H.throw_alert("blind", /obj/screen/alert/blind) - else - H.clear_fullscreen("blind") - H.clear_alert("blind") - - - if(H.disabilities & NEARSIGHTED) //this looks meh but saves a lot of memory by not requiring to add var/prescription - if(H.glasses) //to every /obj/item - var/obj/item/clothing/glasses/G = H.glasses - if(G.prescription) - H.clear_fullscreen("nearsighted") - else - H.overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) - else - H.overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) - else - H.clear_fullscreen("nearsighted") - - if(H.eye_blurry) - H.overlay_fullscreen("blurry", /obj/screen/fullscreen/blurry) - else - H.clear_fullscreen("blurry") - - if(H.druggy) - H.overlay_fullscreen("high", /obj/screen/fullscreen/high) - H.throw_alert("high", /obj/screen/alert/high) - else - H.clear_fullscreen("high") - H.clear_alert("high") +/datum/species/proc/get_perceived_trauma(mob/living/carbon/human/H) + return 100 - ((NO_PAIN in species_traits) ? 0 : H.traumatic_shock) - H.getStaminaLoss() /datum/species/proc/handle_hud_icons(mob/living/carbon/human/H) if(!H.client) return + handle_hud_icons_health(H) + H.handle_hud_icons_health_overlay() + handle_hud_icons_nutrition(H) + +/datum/species/proc/handle_hud_icons_health(mob/living/carbon/H) + if(!H.client) + return + handle_hud_icons_health_side(H) + handle_hud_icons_health_doll(H) + +/datum/species/proc/handle_hud_icons_health_side(mob/living/carbon/human/H) if(H.healths) if(H.stat == DEAD) H.healths.icon_state = "health7" @@ -550,7 +530,7 @@ if(SCREWYHUD_DEAD) H.healths.icon_state = "health7" if(SCREWYHUD_HEALTHY) H.healths.icon_state = "health0" else - switch(100 - ((NO_PAIN in species_traits) ? 0 : H.traumatic_shock) - H.staminaloss) + switch(get_perceived_trauma(H)) if(100 to INFINITY) H.healths.icon_state = "health0" if(80 to 100) H.healths.icon_state = "health1" if(60 to 80) H.healths.icon_state = "health2" @@ -559,6 +539,7 @@ if(0 to 20) H.healths.icon_state = "health5" else H.healths.icon_state = "health6" +/datum/species/proc/handle_hud_icons_health_doll(mob/living/carbon/human/H) if(H.healthdoll) if(H.stat == DEAD) H.healthdoll.icon_state = "healthdoll_DEAD" @@ -588,6 +569,7 @@ H.healthdoll.overlays -= (cached_overlays - new_overlays) H.healthdoll.cached_healthdoll_overlays = new_overlays +/datum/species/proc/handle_hud_icons_nutrition(mob/living/carbon/human/H) switch(H.nutrition) if(NUTRITION_LEVEL_FULL to INFINITY) H.throw_alert("nutrition", /obj/screen/alert/fat) @@ -717,4 +699,4 @@ It'll return null if the organ doesn't correspond, so include null checks when u random_species += initial(S.name) var/picked_species = pick(random_species) var/datum/species/selected_species = GLOB.all_species[picked_species] - return species_name ? picked_species : selected_species.type \ No newline at end of file + return species_name ? picked_species : selected_species.type diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm new file mode 100644 index 00000000000..ec8076cf37b --- /dev/null +++ b/code/modules/mob/living/carbon/human/species/station.dm @@ -0,0 +1,1040 @@ +/datum/species/human + name = "Human" + name_plural = "Humans" + icobase = 'icons/mob/human_races/r_human.dmi' + deform = 'icons/mob/human_races/r_def_human.dmi' + primitive_form = /datum/species/monkey + language = "Sol Common" + species_traits = list(LIPS, CAN_BE_FAT) + skinned_type = /obj/item/stack/sheet/animalhide/human + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_SKIN_TONE | HAS_BODY_MARKINGS + dietflags = DIET_OMNI + blurb = "Humanity originated in the Sol system, and over the last five centuries has spread \ + colonies across a wide swathe of space. They hold a wide range of forms and creeds.

\ + While the central Sol government maintains control of its far-flung people, powerful corporate \ + interests, rampant cyber and bio-augmentation and secretive factions make life on most human \ + worlds tumultous at best." + + reagent_tag = PROCESS_ORG + //Has standard darksight of 2. + +/datum/species/unathi + name = "Unathi" + name_plural = "Unathi" + icobase = 'icons/mob/human_races/r_lizard.dmi' + deform = 'icons/mob/human_races/r_def_lizard.dmi' + language = "Sinta'unathi" + tail = "sogtail" + skinned_type = /obj/item/stack/sheet/animalhide/lizard + unarmed_type = /datum/unarmed_attack/claws + primitive_form = /datum/species/monkey/unathi + + blurb = "A heavily reptillian species, Unathi (or 'Sinta as they call themselves) hail from the \ + Uuosa-Eso system, which roughly translates to 'burning mother'.

Coming from a harsh, radioactive \ + desert planet, they mostly hold ideals of honesty, virtue, martial combat and bravery above all \ + else, frequently even their own lives. They prefer warmer temperatures than most species and \ + their native tongue is a heavy hissing laungage called Sinta'Unathi." + + species_traits = list(LIPS) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_TAIL | HAS_HEAD_ACCESSORY | HAS_BODY_MARKINGS | HAS_HEAD_MARKINGS | HAS_SKIN_COLOR | HAS_ALT_HEADS | TAIL_WAGGING + dietflags = DIET_CARN + + cold_level_1 = 280 //Default 260 - Lower is better + cold_level_2 = 220 //Default 200 + cold_level_3 = 140 //Default 120 + + heat_level_1 = 380 //Default 360 - Higher is better + heat_level_2 = 420 //Default 400 + heat_level_3 = 480 //Default 460 + + flesh_color = "#34AF10" + reagent_tag = PROCESS_ORG + base_color = "#066000" + //Default styles for created mobs. + default_headacc = "Simple" + default_headacc_colour = "#404040" + butt_sprite = "unathi" + brute_mod = 1.05 + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/unathi, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes/unathi //3 darksight. + ) + + allowed_consumed_mobs = list(/mob/living/simple_animal/mouse, /mob/living/simple_animal/lizard, /mob/living/simple_animal/chick, /mob/living/simple_animal/chicken, + /mob/living/simple_animal/crab, /mob/living/simple_animal/butterfly, /mob/living/simple_animal/parrot, /mob/living/simple_animal/tribble) + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is holding their breath!") + + var/datum/action/innate/tail_lash/lash = new() + + +/datum/species/unathi/handle_post_spawn(var/mob/living/carbon/human/H) + lash.Grant(H) + ..() + +/datum/action/innate/tail_lash + name = "Tail lash" + icon_icon = 'icons/effects/effects.dmi' + button_icon_state = "tail" + +/datum/action/innate/tail_lash/Activate() + var/mob/living/carbon/human/user = owner + if(!user.restrained() || !user.buckled) + to_chat(user, "You need freedom of movement to tail lash!") + return + if(user.getStaminaLoss() >= 50) + to_chat(user, "Rest before tail lashing again!") + return + for(var/mob/living/carbon/human/C in orange(1)) + var/obj/item/organ/external/E = C.get_organ(pick("l_leg", "r_leg", "l_foot", "r_foot", "groin")) + if(E) + user.changeNext_move(CLICK_CD_MELEE) + user.visible_message("[src] smacks [C] in [E] with their tail! ", "You hit [C] in [E] with your tail!") + user.adjustStaminaLoss(15) + C.apply_damage(5, BRUTE, E) + user.spin(20, 1) + playsound(user.loc, 'sound/weapons/slash.ogg', 50, 0) + + + +/datum/species/unathi/handle_death(var/mob/living/carbon/human/H) + H.stop_tail_wagging(1) + +/datum/species/tajaran + name = "Tajaran" + name_plural = "Tajaran" + icobase = 'icons/mob/human_races/r_tajaran.dmi' + deform = 'icons/mob/human_races/r_def_tajaran.dmi' + language = "Siik'tajr" + tail = "tajtail" + skinned_type = /obj/item/stack/sheet/fur + unarmed_type = /datum/unarmed_attack/claws + + blurb = "The Tajaran race is a species of feline-like bipeds hailing from the planet of Ahdomai in the \ + S'randarr system. They have been brought up into the space age by the Humans and Skrell, and have been \ + influenced heavily by their long history of Slavemaster rule. They have a structured, clan-influenced way \ + of family and politics. They prefer colder environments, and speak a variety of languages, mostly Siik'Maas, \ + using unique inflections their mouths form." + + cold_level_1 = 240 + cold_level_2 = 180 + cold_level_3 = 100 + + heat_level_1 = 340 + heat_level_2 = 380 + heat_level_3 = 440 + + primitive_form = /datum/species/monkey/tajaran + + species_traits = list(LIPS, CAN_BE_FAT) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_TAIL | HAS_HEAD_ACCESSORY | HAS_HEAD_MARKINGS | HAS_BODY_MARKINGS | HAS_SKIN_COLOR | TAIL_WAGGING + dietflags = DIET_OMNI + taste_sensitivity = TASTE_SENSITIVITY_SHARP + reagent_tag = PROCESS_ORG + flesh_color = "#AFA59E" + base_color = "#424242" + butt_sprite = "tajaran" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/tajaran, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes/tajaran /*Most Tajara see in full colour as a result of genetic augmentation, although it cost them their darksight (darksight = 2) + unless they choose otherwise by selecting the colourblind disability in character creation (darksight = 8 but colourblind).*/ + ) + + allowed_consumed_mobs = list(/mob/living/simple_animal/mouse, /mob/living/simple_animal/chick, /mob/living/simple_animal/butterfly, /mob/living/simple_animal/parrot, + /mob/living/simple_animal/tribble) + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is holding their breath!") + +/datum/species/tajaran/handle_death(var/mob/living/carbon/human/H) + H.stop_tail_wagging(1) + +/datum/species/vulpkanin + name = "Vulpkanin" + name_plural = "Vulpkanin" + icobase = 'icons/mob/human_races/r_vulpkanin.dmi' + deform = 'icons/mob/human_races/r_vulpkanin.dmi' + language = "Canilunzt" + primitive_form = /datum/species/monkey/vulpkanin + tail = "vulptail" + skinned_type = /obj/item/stack/sheet/fur + unarmed_type = /datum/unarmed_attack/claws + + blurb = "Vulpkanin are a species of sharp-witted canine-pideds residing on the planet Altam just barely within the \ + dual-star Vazzend system. Their politically de-centralized society and independent natures have led them to become a species and \ + culture both feared and respected for their scientific breakthroughs. Discovery, loyalty, and utilitarianism dominates their lifestyles \ + to the degree it can cause conflict with more rigorous and strict authorities. They speak a guttural language known as 'Canilunzt' \ + which has a heavy emphasis on utilizing tail positioning and ear twitches to communicate intent." + + species_traits = list(LIPS) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_TAIL | TAIL_WAGGING | TAIL_OVERLAPPED | HAS_HEAD_ACCESSORY | HAS_MARKINGS | HAS_SKIN_COLOR + dietflags = DIET_OMNI + hunger_drain = 0.11 + taste_sensitivity = TASTE_SENSITIVITY_SHARP + reagent_tag = PROCESS_ORG + flesh_color = "#966464" + base_color = "#CF4D2F" + butt_sprite = "vulp" + + scream_verb = "yelps" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/vulpkanin, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes/vulpkanin /*Most Vulpkanin see in full colour as a result of genetic augmentation, although it cost them their darksight (darksight = 2) + unless they choose otherwise by selecting the colourblind disability in character creation (darksight = 8 but colourblind).*/ + ) + + allowed_consumed_mobs = list(/mob/living/simple_animal/mouse, /mob/living/simple_animal/lizard, /mob/living/simple_animal/chick, /mob/living/simple_animal/chicken, + /mob/living/simple_animal/crab, /mob/living/simple_animal/butterfly, /mob/living/simple_animal/parrot, /mob/living/simple_animal/tribble) + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is holding their breath!") + +/datum/species/vulpkanin/handle_death(var/mob/living/carbon/human/H) + H.stop_tail_wagging(1) + +/datum/species/skrell + name = "Skrell" + name_plural = "Skrell" + icobase = 'icons/mob/human_races/r_skrell.dmi' + deform = 'icons/mob/human_races/r_def_skrell.dmi' + language = "Skrellian" + primitive_form = /datum/species/monkey/skrell + + blurb = "An amphibious species, Skrell come from the star system known as Qerr'Vallis, which translates to 'Star of \ + the royals' or 'Light of the Crown'.

Skrell are a highly advanced and logical race who live under the rule \ + of the Qerr'Katish, a caste within their society which keeps the empire of the Skrell running smoothly. Skrell are \ + herbivores on the whole and tend to be co-operative with the other species of the galaxy, although they rarely reveal \ + the secrets of their empire to their allies." + + species_traits = list(LIPS) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_SKIN_COLOR | HAS_BODY_MARKINGS + dietflags = DIET_HERB + taste_sensitivity = TASTE_SENSITIVITY_DULL + flesh_color = "#8CD7A3" + blood_color = "#1D2CBF" + base_color = "#38b661" //RGB: 56, 182, 97. + default_hair_colour = "#38b661" + eyes = "skrell_eyes_s" + //Default styles for created mobs. + default_hair = "Skrell Male Tentacles" + reagent_tag = PROCESS_ORG + butt_sprite = "skrell" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/skrell, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes, //Default darksight of 2. + "headpocket" = /obj/item/organ/internal/headpocket + ) + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their thumbs into their eye sockets!", + "is twisting their own neck!", + "makes like a fish and suffocates!", + "is strangling themselves with their own tendrils!") + +/datum/species/vox + name = "Vox" + name_plural = "Vox" + icobase = 'icons/mob/human_races/vox/r_vox.dmi' + deform = 'icons/mob/human_races/vox/r_def_vox.dmi' + language = "Vox-pidgin" + tail = "voxtail" + speech_sounds = list('sound/voice/shriek1.ogg') + speech_chance = 20 + unarmed_type = /datum/unarmed_attack/claws //I dont think it will hurt to give vox claws too. + + blurb = "The Vox are the broken remnants of a once-proud race, now reduced to little more than \ + scavenging vermin who prey on isolated stations, ships or planets to keep their own ancient arkships \ + alive. They are four to five feet tall, reptillian, beaked, tailed and quilled; human crews often \ + refer to them as 'shitbirds' for their violent and offensive nature, as well as their horrible \ + smell.

Most humans will never meet a Vox raider, instead learning of this insular species through \ + dealing with their traders and merchants; those that do rarely enjoy the experience." + + brute_mod = 1.2 //20% more brute damage. Fragile bird bones. + + warning_low_pressure = 50 + hazard_low_pressure = 0 + + cold_level_1 = 80 + cold_level_2 = 50 + cold_level_3 = 0 + + breathid = "n2" + + eyes = "vox_eyes_s" + + species_traits = list(NO_SCAN, IS_WHITELISTED, NOTRANSSTING) + clothing_flags = HAS_SOCKS + dietflags = DIET_OMNI + bodyflags = HAS_ICON_SKIN_TONE | HAS_TAIL | TAIL_WAGGING | TAIL_OVERLAPPED | HAS_BODY_MARKINGS | HAS_TAIL_MARKINGS + + blood_color = "#2299FC" + flesh_color = "#808D11" + //Default styles for created mobs. + default_hair = "Short Vox Quills" + default_hair_colour = "#614f19" //R: 97, G: 79, B: 25 + butt_sprite = "vox" + + reagent_tag = PROCESS_ORG + scream_verb = "shrieks" + male_scream_sound = 'sound/voice/shriek1.ogg' + female_scream_sound = 'sound/voice/shriek1.ogg' + male_cough_sounds = list('sound/voice/shriekcough.ogg') + female_cough_sounds = list('sound/voice/shriekcough.ogg') + male_sneeze_sound = 'sound/voice/shrieksneeze.ogg' + female_sneeze_sound = 'sound/voice/shrieksneeze.ogg' + + icon_skin_tones = list( + 1 = "Default Green", + 2 = "Dark Green", + 3 = "Brown", + 4 = "Grey", + 5 = "Emerald", + 6 = "Azure" + ) + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs/vox, + "liver" = /obj/item/organ/internal/liver/vox, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes, //Default darksight of 2. + "stack" = /obj/item/organ/internal/stack //Not the same as the cortical stack implant Vox Raiders spawn with. The cortical stack implant is used + ) //for determining the success of the heist game-mode's 'leave nobody behind' objective, while this is just an organ. + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is holding their breath!", + "is deeply inhaling oxygen!") + +/datum/species/vox/handle_death(var/mob/living/carbon/human/H) + H.stop_tail_wagging(1) + +/datum/species/vox/after_equip_job(datum/job/J, mob/living/carbon/human/H) + if(!H.mind || !H.mind.assigned_role || H.mind.assigned_role != "Clown" && H.mind.assigned_role != "Mime") + H.unEquip(H.wear_mask) + H.unEquip(H.l_hand) + + H.equip_or_collect(new /obj/item/clothing/mask/breath/vox(H), slot_wear_mask) + var/tank_pref = H.client && H.client.prefs ? H.client.prefs.speciesprefs : null + if(tank_pref)//Diseasel, here you go + H.equip_or_collect(new /obj/item/tank/nitrogen(H), slot_l_hand) + else + H.equip_or_collect(new /obj/item/tank/emergency_oxygen/vox(H), slot_l_hand) + to_chat(H, "You are now running on nitrogen internals from the [H.l_hand] in your hand. Your species finds oxygen toxic, so you must breathe nitrogen only.") + H.internal = H.l_hand + H.update_action_buttons_icon() + +/datum/species/vox/handle_post_spawn(var/mob/living/carbon/human/H) + updatespeciescolor(H) + H.update_icons() + //H.verbs += /mob/living/carbon/human/proc/leap + ..() + +/datum/species/vox/updatespeciescolor(var/mob/living/carbon/human/H, var/owner_sensitive = 1) //Handling species-specific skin-tones for the Vox race. + if(H.dna.species.bodyflags & HAS_ICON_SKIN_TONE) //Making sure we don't break Armalis. + var/new_icobase = 'icons/mob/human_races/vox/r_vox.dmi' //Default Green Vox. + var/new_deform = 'icons/mob/human_races/vox/r_def_vox.dmi' //Default Green Vox. + switch(H.s_tone) + if(6) //Azure Vox. + new_icobase = 'icons/mob/human_races/vox/r_voxazu.dmi' + new_deform = 'icons/mob/human_races/vox/r_def_voxazu.dmi' + H.tail = "voxtail_azu" + if(5) //Emerald Vox. + new_icobase = 'icons/mob/human_races/vox/r_voxemrl.dmi' + new_deform = 'icons/mob/human_races/vox/r_def_voxemrl.dmi' + H.tail = "voxtail_emrl" + if(4) //Grey Vox. + new_icobase = 'icons/mob/human_races/vox/r_voxgry.dmi' + new_deform = 'icons/mob/human_races/vox/r_def_voxgry.dmi' + H.tail = "voxtail_gry" + if(3) //Brown Vox. + new_icobase = 'icons/mob/human_races/vox/r_voxbrn.dmi' + new_deform = 'icons/mob/human_races/vox/r_def_voxbrn.dmi' + H.tail = "voxtail_brn" + if(2) //Dark Green Vox. + new_icobase = 'icons/mob/human_races/vox/r_voxdgrn.dmi' + new_deform = 'icons/mob/human_races/vox/r_def_voxdgrn.dmi' + H.tail = "voxtail_dgrn" + else //Default Green Vox. + H.tail = "voxtail" //Ensures they get an appropriately coloured tail depending on the skin-tone. + + H.change_icobase(new_icobase, new_deform, owner_sensitive) //Update the icobase/deform of all our organs, but make sure we don't mess with frankenstein limbs in doing so. + H.update_dna() + +/datum/species/vox/handle_reagents(var/mob/living/carbon/human/H, var/datum/reagent/R) + if(R.id == "oxygen") //Armalis are above such petty things. + H.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) //Same as plasma. + H.reagents.remove_reagent(R.id, REAGENTS_METABOLISM) + return 0 //Handling reagent removal on our own. + + return ..() + +/datum/species/vox/armalis/handle_post_spawn(var/mob/living/carbon/human/H) + H.verbs += /mob/living/carbon/human/proc/leap + H.verbs += /mob/living/carbon/human/proc/gut + ..() + +/datum/species/vox/armalis + name = "Vox Armalis" + name_plural = "Vox Armalis" + icobase = 'icons/mob/human_races/r_armalis.dmi' + deform = 'icons/mob/human_races/r_armalis.dmi' + unarmed_type = /datum/unarmed_attack/claws/armalis + + warning_low_pressure = 50 + hazard_low_pressure = 0 + + cold_level_1 = 80 + cold_level_2 = 50 + cold_level_3 = 0 + + heat_level_1 = 2000 + heat_level_2 = 3000 + heat_level_3 = 4000 + + brute_mod = 0.2 + burn_mod = 0.2 + + eyes = "blank_eyes" + + species_traits = list(NO_SCAN, NO_BLOOD, NO_PAIN, IS_WHITELISTED) + bodyflags = HAS_TAIL + dietflags = DIET_OMNI //should inherit this from vox, this is here just in case + + blood_color = "#2299FC" + flesh_color = "#808D11" + + reagent_tag = PROCESS_ORG + + tail = "armalis_tail" + icon_template = 'icons/mob/human_races/r_armalis.dmi' + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs/vox, + "liver" = /obj/item/organ/internal/liver, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "eyes" = /obj/item/organ/internal/eyes, //Default darksight of 2. + "stack" = /obj/item/organ/internal/stack //Not the same as the cortical stack implant Vox Raiders spawn with. The cortical stack implant is used + ) //for determining the success of the heist game-mode's 'leave nobody behind' objective, while this is just an organ. + + suicide_messages = list( + "is attempting to bite their tongue off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is holding their breath!", + "is huffing oxygen!") + +/datum/species/vox/armalis/handle_reagents() //Skip the Vox oxygen reagent toxicity. Armalis are above such things. + return 1 + +/datum/species/kidan + name = "Kidan" + name_plural = "Kidan" + icobase = 'icons/mob/human_races/r_kidan.dmi' + deform = 'icons/mob/human_races/r_def_kidan.dmi' + language = "Chittin" + unarmed_type = /datum/unarmed_attack/claws + + brute_mod = 0.8 + + species_traits = list(IS_WHITELISTED) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_HEAD_ACCESSORY | HAS_HEAD_MARKINGS | HAS_BODY_MARKINGS + eyes = "kidan_eyes_s" + dietflags = DIET_HERB + blood_color = "#FB9800" + reagent_tag = PROCESS_ORG + //Default styles for created mobs. + default_headacc = "Normal Antennae" + butt_sprite = "kidan" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/kidan, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes, //Default darksight of 2. + "lantern" = /obj/item/organ/internal/lantern + ) + + allowed_consumed_mobs = list(/mob/living/simple_animal/diona) + + suicide_messages = list( + "is attempting to bite their antenna off!", + "is jamming their claws into their eye sockets!", + "is twisting their own neck!", + "is cracking their exoskeleton!", + "is stabbing themselves with their mandibles!", + "is holding their breath!") + +/datum/species/slime + name = "Slime People" + name_plural = "Slime People" + language = "Bubblish" + icobase = 'icons/mob/human_races/r_slime.dmi' + deform = 'icons/mob/human_races/r_slime.dmi' + remains_type = /obj/effect/decal/remains/slime + + // More sensitive to the cold + cold_level_1 = 280 + cold_level_2 = 240 + cold_level_3 = 200 + coldmod = 3 + + oxy_mod = 0 + brain_mod = 2.5 + + male_cough_sounds = list('sound/effects/slime_squish.ogg') + female_cough_sounds = list('sound/effects/slime_squish.ogg') + + species_traits = list(LIPS, IS_WHITELISTED, NO_BREATHE, NO_INTORGANS, NO_SCAN) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_SKIN_COLOR | NO_EYES + dietflags = DIET_CARN + reagent_tag = PROCESS_ORG + + blood_color = "#0064C8" + exotic_blood = "water" + blood_damage_type = TOX + + butt_sprite = "slime" + //Has default darksight of 2. + + has_organ = list( + "brain" = /obj/item/organ/internal/brain/slime + ) + + suicide_messages = list( + "is melting into a puddle!", + "is ripping out their own core!", + "is turning a dull, brown color and melting into a puddle!") + + var/reagent_skin_coloring = FALSE + + var/datum/action/innate/regrow/grow = new() + + species_abilities = list( + /mob/living/carbon/human/verb/toggle_recolor_verb, + /mob/living/carbon/human/proc/regrow_limbs + ) + +/datum/species/slime/handle_post_spawn(var/mob/living/carbon/human/H) + grow.Grant(H) + ..() + +/datum/action/innate/regrow + name = "Regrow limbs" + icon_icon = 'icons/effects/effects.dmi' + button_icon_state = "greenglow" + +/datum/action/innate/regrow/Activate() + var/mob/living/carbon/human/user = owner + user.regrow_limbs() + + +/datum/species/slime/handle_life(var/mob/living/carbon/human/H) +//This is allegedly for code "style". Like a plaid sweater? +#define SLIMEPERSON_COLOR_SHIFT_TRIGGER 0.1 +#define SLIMEPERSON_ICON_UPDATE_PERIOD 200 // 20 seconds +#define SLIMEPERSON_BLOOD_SCALING_FACTOR 5 // Used to adjust how much of an effect the blood has on the rate of color change. Higher is slower. + // Slowly shifting to the color of the reagents + if(reagent_skin_coloring && H.reagents.total_volume > SLIMEPERSON_COLOR_SHIFT_TRIGGER) + var/blood_amount = H.blood_volume + var/r_color = mix_color_from_reagents(H.reagents.reagent_list) + var/new_body_color = BlendRGB(r_color, H.skin_colour, (blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)/((blood_amount*SLIMEPERSON_BLOOD_SCALING_FACTOR)+(H.reagents.total_volume))) + H.skin_colour = new_body_color + if(world.time % SLIMEPERSON_ICON_UPDATE_PERIOD > SLIMEPERSON_ICON_UPDATE_PERIOD - 20) // The 20 is because this gets called every 2 seconds, from the mob controller + for(var/organname in H.bodyparts_by_name) + var/obj/item/organ/external/E = H.bodyparts_by_name[organname] + if(istype(E) && E.dna && istype(E.dna.species, /datum/species/slime)) + E.sync_colour_to_human(H) + H.update_hair(0) + H.update_body() + ..() + +#undef SLIMEPERSON_COLOR_SHIFT_TRIGGER +#undef SLIMEPERSON_ICON_UPDATE_PERIOD +#undef SLIMEPERSON_BLOOD_SCALING_FACTOR + +/mob/living/carbon/human/proc/toggle_recolor(silent = FALSE) + if(!isslimeperson(src)) + if(!silent) + to_chat(src, "You're not a slime person!") + return + + var/datum/species/slime/S = dna.species + if(S.reagent_skin_coloring) + S.reagent_skin_coloring = TRUE + if(!silent) + to_chat(src, "You adjust your internal chemistry to filter out pigments from things you consume.") + else + S.reagent_skin_coloring = TRUE + if(!silent) + to_chat(src, "You adjust your internal chemistry to permit pigments in chemicals you consume to tint you.") + +/mob/living/carbon/human/verb/toggle_recolor_verb() + set category = "IC" + set name = "Toggle Reagent Recoloring" + set desc = "While active, you'll slowly adjust your body's color to that of the reagents inside of you, moderated by how much blood you have." + + toggle_recolor() + + +/mob/living/carbon/human/proc/regrow_limbs() + set category = "IC" + set name = "Regrow Limbs" + set desc = "Regrow one of your missing limbs at the cost of a large amount of hunger" + +#define SLIMEPERSON_HUNGERCOST 50 +#define SLIMEPERSON_MINHUNGER 250 +#define SLIMEPERSON_REGROWTHDELAY 450 // 45 seconds + + if(stat || paralysis || stunned) + to_chat(src, "You cannot regenerate missing limbs in your current state.") + return + + if(nutrition < SLIMEPERSON_MINHUNGER) + to_chat(src, "You're too hungry to regenerate a limb!") + return + + var/list/missing_limbs = list() + for(var/l in bodyparts_by_name) + var/obj/item/organ/external/E = bodyparts_by_name[l] + if(!istype(E)) + var/list/limblist = dna.species.has_limbs[l] + var/obj/item/organ/external/limb = limblist["path"] + var/parent_organ = initial(limb.parent_organ) + var/obj/item/organ/external/parentLimb = bodyparts_by_name[parent_organ] + if(!istype(parentLimb)) + continue + missing_limbs[initial(limb.name)] = l + + if(!missing_limbs.len) + to_chat(src, "You're not missing any limbs!") + return + + var/limb_select = input(src, "Choose a limb to regrow", "Limb Regrowth") as null|anything in missing_limbs + var/chosen_limb = missing_limbs[limb_select] + + visible_message("[src] begins to hold still and concentrate on [p_their()] missing [limb_select]...", "You begin to focus on regrowing your missing [limb_select]... (This will take [round(SLIMEPERSON_REGROWTHDELAY/10)] seconds, and you must hold still.)") + if(do_after(src, SLIMEPERSON_REGROWTHDELAY, needhand=0, target = src)) + if(stat || paralysis || stunned) + to_chat(src, "You cannot regenerate missing limbs in your current state.") + return + + if(nutrition < SLIMEPERSON_MINHUNGER) + to_chat(src, "You're too hungry to regenerate a limb!") + return + + var/obj/item/organ/external/O = bodyparts_by_name[chosen_limb] + + var/stored_brute = 0 + var/stored_burn = 0 + if(istype(O)) + to_chat(src, "You distribute the damaged tissue around your body, out of the way of your new pseudopod!") + var/obj/item/organ/external/doomedStump = O + stored_brute = doomedStump.brute_dam + stored_burn = doomedStump.burn_dam + qdel(O) + + var/limb_list = dna.species.has_limbs[chosen_limb] + var/obj/item/organ/external/limb_path = limb_list["path"] + // Parent check + var/obj/item/organ/external/potential_parent = bodyparts_by_name[initial(limb_path.parent_organ)] + if(!istype(potential_parent)) + to_chat(src, "You've lost the organ that you've been growing your new part on!") + return // No rayman for you + // Grah this line will leave a "not used" warning, in spite of the fact that the new() proc WILL do the thing. + // Bothersome. + var/obj/item/organ/external/new_limb = new limb_path(src) + new_limb.open = 0 // This is just so that the compiler won't think that new_limb is unused, because the compiler is horribly stupid. + adjustBruteLoss(stored_brute) + adjustFireLoss(stored_burn) + update_body() + updatehealth("slime person regrowth") + UpdateDamageIcon() + nutrition -= SLIMEPERSON_HUNGERCOST + visible_message("[src] finishes regrowing [p_their()] missing [new_limb]!", "You finish regrowing your [limb_select]") + else + to_chat(src, "You need to hold still in order to regrow a limb!") + return + +#undef SLIMEPERSON_HUNGERCOST +#undef SLIMEPERSON_MINHUNGER +#undef SLIMEPERSON_REGROWTHDELAY + +/datum/species/slime/handle_pre_change(mob/living/carbon/human/H) + ..() + if(reagent_skin_coloring) + H.toggle_recolor(silent = 1) + +/datum/species/grey + name = "Grey" + name_plural = "Greys" + icobase = 'icons/mob/human_races/r_grey.dmi' + deform = 'icons/mob/human_races/r_def_grey.dmi' + language = "Psionic Communication" + eyes = "grey_eyes_s" + butt_sprite = "grey" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart, + "lungs" = /obj/item/organ/internal/lungs, + "liver" = /obj/item/organ/internal/liver/grey, + "kidneys" = /obj/item/organ/internal/kidneys, + "brain" = /obj/item/organ/internal/brain/grey, + "appendix" = /obj/item/organ/internal/appendix, + "eyes" = /obj/item/organ/internal/eyes/grey //5 darksight. + ) + + brute_mod = 1.25 //greys are fragile + + default_genes = list(REMOTE_TALK) + + + species_traits = list(LIPS, IS_WHITELISTED, CAN_BE_FAT) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_BODY_MARKINGS + dietflags = DIET_HERB + reagent_tag = PROCESS_ORG + blood_color = "#A200FF" + +/datum/species/grey/handle_dna(var/mob/living/carbon/C, var/remove) + if(!remove) + C.dna.SetSEState(REMOTETALKBLOCK,1,1) + genemutcheck(C,REMOTETALKBLOCK,null,MUTCHK_FORCED) + else + C.dna.SetSEState(REMOTETALKBLOCK,0,1) + genemutcheck(C,REMOTETALKBLOCK,null,MUTCHK_FORCED) + ..() + +/datum/species/grey/water_act(var/mob/living/carbon/C, volume, temperature, source) + ..() + C.take_organ_damage(5,min(volume,20)) + C.emote("scream") + +/datum/species/grey/after_equip_job(datum/job/J, mob/living/carbon/human/H) + var/speech_pref = H.client.prefs.speciesprefs + if(speech_pref) + H.mind.speech_span = "wingdings" + +/datum/species/grey/handle_reagents(mob/living/carbon/human/H, datum/reagent/R) + if(R.id == "sacid") + H.reagents.del_reagent(R.id) + return 0 + return ..() + +/datum/species/diona + name = "Diona" + name_plural = "Dionaea" + icobase = 'icons/mob/human_races/r_diona.dmi' + deform = 'icons/mob/human_races/r_def_plant.dmi' + language = "Rootspeak" + speech_sounds = list('sound/voice/dionatalk1.ogg') //Credit https://www.youtube.com/watch?v=ufnvlRjsOTI [0:13 - 0:16] + speech_chance = 20 + unarmed_type = /datum/unarmed_attack/diona + //primitive_form = "Nymph" + slowdown = 5 + remains_type = /obj/effect/decal/cleanable/ash + + + warning_low_pressure = 50 + hazard_low_pressure = -1 + + cold_level_1 = 50 + cold_level_2 = -1 + cold_level_3 = -1 + + heat_level_1 = 300 + heat_level_2 = 340 + heat_level_3 = 400 + + blurb = "Commonly referred to (erroneously) as 'plant people', the Dionaea are a strange space-dwelling collective \ + species hailing from Epsilon Ursae Minoris. Each 'diona' is a cluster of numerous cat-sized organisms called nymphs; \ + there is no effective upper limit to the number that can fuse in gestalt, and reports exist of the Epsilon Ursae \ + Minoris primary being ringed with a cloud of singing space-station-sized entities.

The Dionaea coexist peacefully with \ + all known species, especially the Skrell. Their communal mind makes them slow to react, and they have difficulty understanding \ + even the simplest concepts of other minds. Their alien physiology allows them survive happily off a diet of nothing but light, \ + water and other radiation." + + species_traits = list(NO_BREATHE, RADIMMUNE, IS_PLANT, NO_BLOOD, NO_PAIN) + clothing_flags = HAS_SOCKS + default_hair_colour = "#000000" + dietflags = 0 //Diona regenerate nutrition in light and water, no diet necessary + taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE + skinned_type = /obj/item/stack/sheet/wood + + oxy_mod = 0 + + body_temperature = T0C + 15 //make the plant people have a bit lower body temperature, why not + blood_color = "#004400" + flesh_color = "#907E4A" + butt_sprite = "diona" + + reagent_tag = PROCESS_ORG + + has_organ = list( + "nutrient channel" = /obj/item/organ/internal/liver/diona, + "neural strata" = /obj/item/organ/internal/heart/diona, + "receptor node" = /obj/item/organ/internal/eyes/diona, //Default darksight of 2. + "gas bladder" = /obj/item/organ/internal/brain/diona, + "polyp segment" = /obj/item/organ/internal/kidneys/diona, + "anchoring ligament" = /obj/item/organ/internal/appendix/diona + ) + + vision_organ = /obj/item/organ/internal/eyes/diona + has_limbs = list( + "chest" = list("path" = /obj/item/organ/external/chest/diona), + "groin" = list("path" = /obj/item/organ/external/groin/diona), + "head" = list("path" = /obj/item/organ/external/head/diona), + "l_arm" = list("path" = /obj/item/organ/external/arm/diona), + "r_arm" = list("path" = /obj/item/organ/external/arm/right/diona), + "l_leg" = list("path" = /obj/item/organ/external/leg/diona), + "r_leg" = list("path" = /obj/item/organ/external/leg/right/diona), + "l_hand" = list("path" = /obj/item/organ/external/hand/diona), + "r_hand" = list("path" = /obj/item/organ/external/hand/right/diona), + "l_foot" = list("path" = /obj/item/organ/external/foot/diona), + "r_foot" = list("path" = /obj/item/organ/external/foot/right/diona) + ) + + suicide_messages = list( + "is losing branches!", + "pulls out a secret stash of herbicide and takes a hearty swig!", + "is pulling themselves apart!") + +/datum/species/diona/can_understand(var/mob/other) + if(istype(other, /mob/living/simple_animal/diona)) + return 1 + return 0 + +/datum/species/diona/handle_post_spawn(var/mob/living/carbon/human/H) + H.gender = NEUTER + + return ..() + +/datum/species/diona/handle_life(var/mob/living/carbon/human/H) + H.radiation = Clamp(H.radiation, 0, 100) //We have to clamp this first, then decrease it, or there's a few edge cases of massive heals if we clamp and decrease at the same time. + var/rads = H.radiation / 25 + H.radiation = max(H.radiation-rads, 0) + H.nutrition = min(H.nutrition+rads, NUTRITION_LEVEL_WELL_FED+10) + H.adjustBruteLoss(-(rads)) + H.adjustToxLoss(-(rads)) + + var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing + if(isturf(H.loc)) //else, there's considered to be no light + var/turf/T = H.loc + light_amount = min(T.get_lumcount() * 10, 5) //hardcapped so it's not abused by having a ton of flashlights + H.nutrition = min(H.nutrition+light_amount, NUTRITION_LEVEL_WELL_FED+10) + + if(light_amount > 0) + H.clear_alert("nolight") + else + H.throw_alert("nolight", /obj/screen/alert/nolight) + + if((light_amount >= 5) && !H.suiciding) //if there's enough light, heal + + H.adjustBruteLoss(-(light_amount/2)) + H.adjustFireLoss(-(light_amount/4)) + if(H.nutrition < NUTRITION_LEVEL_STARVING+50) + H.take_overall_damage(10,0) + ..() + +/datum/species/machine + name = "Machine" + name_plural = "Machines" + + blurb = "Positronic intelligence really took off in the 26th century, and it is not uncommon to see independant, free-willed \ + robots on many human stations, particularly in fringe systems where standards are slightly lax and public opinion less relevant \ + to corporate operations. IPCs (Integrated Positronic Chassis) are a loose category of self-willed robots with a humanoid form, \ + generally self-owned after being 'born' into servitude; they are reliable and dedicated workers, albeit more than slightly \ + inhuman in outlook and perspective." + + icobase = 'icons/mob/human_races/r_machine.dmi' + deform = 'icons/mob/human_races/r_machine.dmi' + language = "Trinary" + remains_type = /obj/effect/decal/remains/robot + skinned_type = /obj/item/stack/sheet/metal // Let's grind up IPCs for station resources! + + eyes = "blank_eyes" + brute_mod = 2.5 // 100% * 2.5 * 0.6 (robolimbs) ~= 150% + burn_mod = 2.5 // So they take 50% extra damage from brute/burn overall. + tox_mod = 0 + clone_mod = 0 + oxy_mod = 0 + death_message = "gives one shrill beep before falling limp, their monitor flashing blue before completely shutting off..." + + species_traits = list(IS_WHITELISTED, NO_BREATHE, NO_SCAN, NO_BLOOD, NO_PAIN, NO_DNA, RADIMMUNE, VIRUSIMMUNE, NOTRANSSTING) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT | HAS_SOCKS + bodyflags = HAS_SKIN_COLOR | HAS_HEAD_MARKINGS | HAS_HEAD_ACCESSORY | ALL_RPARTS + dietflags = 0 //IPCs can't eat, so no diet + taste_sensitivity = TASTE_SENSITIVITY_NO_TASTE + blood_color = "#1F181F" + flesh_color = "#AAAAAA" + //Default styles for created mobs. + default_hair = "Blue IPC Screen" + can_revive_by_healing = 1 + has_gender = FALSE + reagent_tag = PROCESS_SYN + male_scream_sound = 'sound/goonstation/voice/robot_scream.ogg' + female_scream_sound = 'sound/goonstation/voice/robot_scream.ogg' + male_cough_sounds = list('sound/effects/mob_effects/m_machine_cougha.ogg','sound/effects/mob_effects/m_machine_coughb.ogg', 'sound/effects/mob_effects/m_machine_coughc.ogg') + female_cough_sounds = list('sound/effects/mob_effects/f_machine_cougha.ogg','sound/effects/mob_effects/f_machine_coughb.ogg') + male_sneeze_sound = 'sound/effects/mob_effects/machine_sneeze.ogg' + female_sneeze_sound = 'sound/effects/mob_effects/f_machine_sneeze.ogg' + butt_sprite = "machine" + + has_organ = list( + "brain" = /obj/item/organ/internal/brain/mmi_holder/posibrain, + "cell" = /obj/item/organ/internal/cell, + "optics" = /obj/item/organ/internal/eyes/optical_sensor, //Default darksight of 2. + "charger" = /obj/item/organ/internal/cyberimp/arm/power_cord + ) + + vision_organ = /obj/item/organ/internal/eyes/optical_sensor + has_limbs = list( + "chest" = list("path" = /obj/item/organ/external/chest/ipc), + "groin" = list("path" = /obj/item/organ/external/groin/ipc), + "head" = list("path" = /obj/item/organ/external/head/ipc), + "l_arm" = list("path" = /obj/item/organ/external/arm/ipc), + "r_arm" = list("path" = /obj/item/organ/external/arm/right/ipc), + "l_leg" = list("path" = /obj/item/organ/external/leg/ipc), + "r_leg" = list("path" = /obj/item/organ/external/leg/right/ipc), + "l_hand" = list("path" = /obj/item/organ/external/hand/ipc), + "r_hand" = list("path" = /obj/item/organ/external/hand/right/ipc), + "l_foot" = list("path" = /obj/item/organ/external/foot/ipc), + "r_foot" = list("path" = /obj/item/organ/external/foot/right/ipc) + ) + + suicide_messages = list( + "is powering down!", + "is smashing their own monitor!", + "is twisting their own neck!", + "is downloading extra RAM!", + "is frying their own circuits!", + "is blocking their ventilation port!") + + species_abilities = list( + /mob/living/carbon/human/proc/change_monitor + ) + +/datum/species/machine/handle_death(var/mob/living/carbon/human/H) + var/obj/item/organ/external/head/head_organ = H.get_organ("head") + if(!head_organ) + return + head_organ.h_style = "Bald" + head_organ.f_style = "Shaved" + spawn(100) + if(H) + H.update_hair() + H.update_fhair() + +/datum/species/drask + name = "Drask" + name_plural = "Drask" + icobase = 'icons/mob/human_races/r_drask.dmi' + deform = 'icons/mob/human_races/r_drask.dmi' + language = "Orluum" + eyes = "drask_eyes_s" + + speech_sounds = list('sound/voice/DraskTalk.ogg') + speech_chance = 20 + male_scream_sound = 'sound/voice/DraskTalk2.ogg' + female_scream_sound = 'sound/voice/DraskTalk2.ogg' + male_cough_sounds = 'sound/voice/DraskCough.ogg' + female_cough_sounds = 'sound/voice/DraskCough.ogg' + male_sneeze_sound = 'sound/voice/DraskSneeze.ogg' + female_sneeze_sound = 'sound/voice/DraskSneeze.ogg' + + burn_mod = 2 + //exotic_blood = "cryoxadone" + body_temperature = 273 + + blurb = "Hailing from Hoorlm, planet outside what is usually considered a habitable \ + orbit, the Drask evolved to live in extreme cold. Their strange bodies seem \ + to operate better the colder their surroundings are, and can regenerate rapidly \ + when breathing supercooled gas.

On their homeworld, the Drask live long lives \ + in their labyrinthine settlements, carved out beneath Hoorlm's icy surface, where the air \ + is of breathable density." + + suicide_messages = list( + "is self-warming with friction!", + "is jamming fingers through their big eyes!", + "is sucking in warm air!", + "is holding their breath!") + + species_traits = list(LIPS, IS_WHITELISTED) + clothing_flags = HAS_UNDERWEAR | HAS_UNDERSHIRT + bodyflags = HAS_SKIN_TONE | HAS_BODY_MARKINGS + dietflags = DIET_OMNI + + cold_level_1 = -1 //Default 260 - Lower is better + cold_level_2 = -1 //Default 200 + cold_level_3 = -1 //Default 120 + coldmod = -1 + + heat_level_1 = 300 //Default 360 - Higher is better + heat_level_2 = 340 //Default 400 + heat_level_3 = 400 //Default 460 + heatmod = 2 + + flesh_color = "#a3d4eb" + reagent_tag = PROCESS_ORG + base_color = "#a3d4eb" + blood_color = "#a3d4eb" + butt_sprite = "drask" + + has_organ = list( + "heart" = /obj/item/organ/internal/heart/drask, + "lungs" = /obj/item/organ/internal/lungs/drask, + "metabolic strainer" = /obj/item/organ/internal/liver/drask, + "eyes" = /obj/item/organ/internal/eyes/drask, //5 darksight. + "brain" = /obj/item/organ/internal/brain/drask + ) diff --git a/code/modules/mob/living/carbon/human/update_stat.dm b/code/modules/mob/living/carbon/human/update_stat.dm new file mode 100644 index 00000000000..1d900d478d6 --- /dev/null +++ b/code/modules/mob/living/carbon/human/update_stat.dm @@ -0,0 +1,20 @@ +/mob/living/carbon/human/update_stat(reason = "none given") + if(status_flags & GODMODE) + return + ..(reason) + if(stat != DEAD) + switch(getBrainLoss()) + if(100 to 120) + Weaken(20) + create_debug_log("collapsed from brain damage, trigger reason: [reason]") + if(120 to INFINITY) + visible_message("[src] goes limp, [p_their()] facial expression utterly blank.") + death() + create_debug_log("died of brain damage, trigger reason: [reason]") + else + if(dna.species && dna.species.can_revive_by_healing) + var/obj/item/organ/internal/brain/B = get_int_organ(/obj/item/organ/internal/brain) + if(B) + if((health >= (config.health_threshold_dead + config.health_threshold_crit) * 0.5) && getBrainLoss()<120) + update_revive() + create_debug_log("revived from healing, trigger reason: [reason]") diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 1a590c2e397..18e42c98d08 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -219,19 +219,19 @@ radiation-- if(prob(25)) adjustToxLoss(1) - updatehealth() + updatehealth("handle mutations and radiation(0-50)") if(50 to 75) radiation -= 2 adjustToxLoss(1) if(prob(5)) radiation -= 5 - updatehealth() + updatehealth("handle mutations and radiation(50-75)") if(75 to 100) radiation -= 3 adjustToxLoss(3) - updatehealth() + updatehealth("handle mutations and radiation(75-100)") radiation = Clamp(radiation, 0, 100) @@ -259,39 +259,11 @@ M.adjustBruteLoss(5) nutrition += 10 -//This updates the health and status of the mob (conscious, unconscious, dead) -/mob/living/carbon/handle_regular_status_updates() - - if(..()) //alive - - if(health <= config.health_threshold_dead) - death() - return - - if(getOxyLoss() > 50 || health <= config.health_threshold_crit) - Paralyse(3) - stat = UNCONSCIOUS - - if(sleeping) - stat = UNCONSCIOUS - - return 1 - -/mob/living/carbon/proc/CheckStamina() - if(staminaloss) - var/total_health = (health - staminaloss) - if(total_health <= config.health_threshold_softcrit && !stat) - to_chat(src, "You're too exhausted to keep going...") - Weaken(5) - setStaminaLoss(health - 2) - return - setStaminaLoss(max((staminaloss - 3), 0)) - //this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. /mob/living/carbon/handle_status_effects() ..() - CheckStamina() + setStaminaLoss(max((staminaloss - 3), 0)) var/restingpwr = 1 + 4 * resting @@ -375,61 +347,6 @@ Sleeping(2) return sleeping - -//this handles hud updates. Calls update_vision() and handle_hud_icons() -/mob/living/carbon/handle_regular_hud_updates() - if(!client) - return 0 - - if(stat == UNCONSCIOUS && health <= config.health_threshold_crit) - var/severity = 0 - switch(health) - if(-20 to -10) severity = 1 - if(-30 to -20) severity = 2 - if(-40 to -30) severity = 3 - if(-50 to -40) severity = 4 - if(-60 to -50) severity = 5 - if(-70 to -60) severity = 6 - if(-80 to -70) severity = 7 - if(-90 to -80) severity = 8 - if(-95 to -90) severity = 9 - if(-INFINITY to -95) severity = 10 - overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity) - else - clear_fullscreen("crit") - if(oxyloss) - var/severity = 0 - switch(oxyloss) - if(10 to 20) severity = 1 - if(20 to 25) severity = 2 - if(25 to 30) severity = 3 - if(30 to 35) severity = 4 - if(35 to 40) severity = 5 - if(40 to 45) severity = 6 - if(45 to INFINITY) severity = 7 - overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity) - else - clear_fullscreen("oxy") - - //Fire and Brute damage overlay (BSSR) - var/hurtdamage = getBruteLoss() + getFireLoss() + damageoverlaytemp - damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. - if(hurtdamage) - var/severity = 0 - switch(hurtdamage) - if(5 to 15) severity = 1 - if(15 to 30) severity = 2 - if(30 to 45) severity = 3 - if(45 to 70) severity = 4 - if(70 to 85) severity = 5 - if(85 to INFINITY) severity = 6 - overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) - else - clear_fullscreen("brute") - - ..() - return 1 - /mob/living/carbon/update_sight() if(!client) return @@ -464,6 +381,9 @@ return /mob/living/carbon/handle_hud_icons_health() + if(!client) + return + if(healths) if(stat != DEAD) switch(health) @@ -483,3 +403,51 @@ healths.icon_state = "health6" else healths.icon_state = "health7" + handle_hud_icons_health_overlay() + +/mob/living/carbon/proc/handle_hud_icons_health_overlay() + if(stat == UNCONSCIOUS && health <= config.health_threshold_crit) + var/severity = 0 + switch(health) + if(-20 to -10) severity = 1 + if(-30 to -20) severity = 2 + if(-40 to -30) severity = 3 + if(-50 to -40) severity = 4 + if(-60 to -50) severity = 5 + if(-70 to -60) severity = 6 + if(-80 to -70) severity = 7 + if(-90 to -80) severity = 8 + if(-95 to -90) severity = 9 + if(-INFINITY to -95) severity = 10 + overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity) + else if(stat == CONSCIOUS) + clear_fullscreen("crit") + if(oxyloss) + var/severity = 0 + switch(oxyloss) + if(10 to 20) severity = 1 + if(20 to 25) severity = 2 + if(25 to 30) severity = 3 + if(30 to 35) severity = 4 + if(35 to 40) severity = 5 + if(40 to 45) severity = 6 + if(45 to INFINITY) severity = 7 + overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity) + else + clear_fullscreen("oxy") + + //Fire and Brute damage overlay (BSSR) + var/hurtdamage = getBruteLoss() + getFireLoss() + damageoverlaytemp + damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not. + if(hurtdamage) + var/severity = 0 + switch(hurtdamage) + if(5 to 15) severity = 1 + if(15 to 30) severity = 2 + if(30 to 45) severity = 3 + if(45 to 70) severity = 4 + if(70 to 85) severity = 5 + if(85 to INFINITY) severity = 6 + overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity) + else + clear_fullscreen("brute") diff --git a/code/modules/mob/living/carbon/slime/death.dm b/code/modules/mob/living/carbon/slime/death.dm index 5c551d6e470..055f972df07 100644 --- a/code/modules/mob/living/carbon/slime/death.dm +++ b/code/modules/mob/living/carbon/slime/death.dm @@ -1,6 +1,8 @@ /mob/living/carbon/slime/death(gibbed) - if(stat == DEAD) - return + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE if(!gibbed) if(is_adult) var/mob/living/carbon/slime/M = new /mob/living/carbon/slime(loc) @@ -15,13 +17,5 @@ return else visible_message("The [name] seizes up and falls limp...") - stat = DEAD icon_state = "[colour] baby slime dead" - overlays.len = 0 - - update_canmove() - - if(ticker && ticker.mode) - ticker.mode.check_win() - - return ..(gibbed) \ No newline at end of file + overlays.Cut() diff --git a/code/modules/mob/living/carbon/slime/life.dm b/code/modules/mob/living/carbon/slime/life.dm index 5b0ee885ce7..2f2c05c9452 100644 --- a/code/modules/mob/living/carbon/slime/life.dm +++ b/code/modules/mob/living/carbon/slime/life.dm @@ -131,7 +131,7 @@ else // a hot place bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1) - updatehealth() + updatehealth("handle environment") return //TODO: DEFERRED @@ -163,7 +163,7 @@ if(reagents.get_reagent_amount("epinephrine")>=5) mutation_chance = max(mutation_chance - 5,0) //Prevents mutation chance going <0% reagents.remove_reagent("epinephrine", 5) - updatehealth() + updatehealth("handle chemicals in body") return //TODO: DEFERRED @@ -195,7 +195,6 @@ if(src.stat == DEAD) src.lying = 1 - src.blinded = 1 else if(src.paralysis || src.stunned || src.weakened || (status_flags && FAKEDEATH)) //Stunned etc. if(src.stunned > 0) @@ -207,7 +206,6 @@ src.stat = 0 if(src.paralysis > 0) AdjustParalysis(-1) - src.blinded = 0 src.lying = 0 src.stat = 0 @@ -219,7 +217,6 @@ if(src.eye_blind) src.SetEyeBlind(0) - src.blinded = 1 if(src.ear_deaf > 0) SetEarDeaf(0) if(src.ear_damage < 25) @@ -227,8 +224,6 @@ src.density = !( src.lying ) - if(src.disabilities & BLIND) - src.blinded = 1 if(src.disabilities & DEAF) EarDeaf(1) diff --git a/code/modules/mob/living/carbon/slime/powers.dm b/code/modules/mob/living/carbon/slime/powers.dm index a2aca96c163..23918680197 100644 --- a/code/modules/mob/living/carbon/slime/powers.dm +++ b/code/modules/mob/living/carbon/slime/powers.dm @@ -102,9 +102,9 @@ adjustFireLoss(-10) adjustCloneLoss(-10) - updatehealth() + updatehealth("slime feeding") if(Victim) - Victim.updatehealth() + Victim.updatehealth("slime feeding") sleep(rand(15,45)) diff --git a/code/modules/mob/living/carbon/update_status.dm b/code/modules/mob/living/carbon/update_status.dm index 33838b3e8f2..63d34788a98 100644 --- a/code/modules/mob/living/carbon/update_status.dm +++ b/code/modules/mob/living/carbon/update_status.dm @@ -1,15 +1,29 @@ -/mob/living/carbon/update_stat() +/mob/living/carbon/update_stat(reason = "none given") if(status_flags & GODMODE) return if(stat != DEAD) // if(health <= min_health) if(health <= config.health_threshold_dead) death() + create_debug_log("died of damage, trigger reason: [reason]") return // if(paralysis || sleeping || getOxyLoss() > low_oxy_ko || (status_flags & FAKEDEATH) || health <= crit_health) if(paralysis || sleeping || getOxyLoss() > 50 || (status_flags & FAKEDEATH) || health <= config.health_threshold_crit) if(stat == CONSCIOUS) KnockOut() + create_debug_log("fell unconscious, trigger reason: [reason]") else if(stat == UNCONSCIOUS) WakeUp() + create_debug_log("woke up, trigger reason: [reason]") + +/mob/living/carbon/update_stamina() + ..() + if(staminaloss) + var/total_health = (health - staminaloss) + if(total_health <= config.health_threshold_softcrit && !stat) + to_chat(src, "You're too exhausted to keep going...") + Weaken(5) + setStaminaLoss(health - 2) + handle_hud_icons_health() + return diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 96caf40b191..734dd556b48 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -24,7 +24,7 @@ adjustCloneLoss(damage * blocked) if(STAMINA) adjustStaminaLoss(damage * blocked) - updatehealth() + updatehealth("apply damage") return 1 /mob/living/proc/apply_damage_type(damage = 0, damagetype = BRUTE) //like apply damage except it always uses the damage procs @@ -83,7 +83,7 @@ if(JITTER) if(status_flags & CANSTUN) Jitter(effect * blocked) - updatehealth() + updatehealth("apply effect") return 1 /mob/living/proc/apply_effects(var/stun = 0, var/weaken = 0, var/paralyze = 0, var/irradiate = 0, var/slur = 0, var/stutter = 0, var/eyeblur = 0, var/drowsy = 0, var/blocked = 0, var/stamina = 0, var/jitter = 0) @@ -99,3 +99,205 @@ if(stamina) apply_damage(stamina, STAMINA, null, blocked) if(jitter) apply_effect(jitter, JITTER, blocked) return 1 + + +/mob/living/proc/getBruteLoss() + return bruteloss + +/mob/living/proc/adjustBruteLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_bruteloss = bruteloss + bruteloss = min(max(bruteloss + amount, 0),(maxHealth*2)) + if(old_bruteloss == bruteloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("adjustBruteLoss") + +/mob/living/proc/getOxyLoss() + return oxyloss + +/mob/living/proc/adjustOxyLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_oxyloss = oxyloss + oxyloss = min(max(oxyloss + amount, 0),(maxHealth*2)) + if(old_oxyloss == oxyloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("adjustOxyLoss") + +/mob/living/proc/setOxyLoss(amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_oxyloss = oxyloss + oxyloss = amount + if(old_oxyloss == oxyloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("setOxyLoss") + +/mob/living/proc/getToxLoss() + return toxloss + +/mob/living/proc/adjustToxLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_toxloss = toxloss + toxloss = min(max(toxloss + amount, 0),(maxHealth*2)) + if(old_toxloss == toxloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("adjustToxLoss") + +/mob/living/proc/setToxLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_toxloss = toxloss + toxloss = amount + if(old_toxloss == toxloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("setToxLoss") + +/mob/living/proc/getFireLoss() + return fireloss + +/mob/living/proc/adjustFireLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_fireloss = fireloss + fireloss = min(max(fireloss + amount, 0),(maxHealth*2)) + if(old_fireloss == fireloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("adjustFireLoss") + +/mob/living/proc/getCloneLoss() + return cloneloss + +/mob/living/proc/adjustCloneLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + var/old_cloneloss = cloneloss + cloneloss = min(max(cloneloss + amount, 0),(maxHealth*2)) + if(old_cloneloss == cloneloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("adjustCloneLoss") + +/mob/living/proc/setCloneLoss(var/amount, updating_health = TRUE) + if(status_flags & GODMODE) return 0 //godmode + var/old_cloneloss = cloneloss + cloneloss = amount + if(old_cloneloss == cloneloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth("setCloneLoss") + +/mob/living/proc/getBrainLoss() + return 0 + +/mob/living/proc/adjustBrainLoss(amount, updating = TRUE) + return STATUS_UPDATE_NONE + +/mob/living/proc/setBrainLoss(amount, updating = TRUE) + return STATUS_UPDATE_NONE + +/mob/living/proc/getStaminaLoss() + return staminaloss + +/mob/living/proc/adjustStaminaLoss(amount, updating = TRUE) + if(status_flags & GODMODE) + return FALSE + var/old_stamloss = staminaloss + staminaloss = min(max(staminaloss + amount, 0),(maxHealth*2)) + if(old_stamloss == staminaloss) + updating = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_STAMINA + if(updating) + handle_hud_icons_health() + update_stamina() + +/mob/living/proc/setStaminaLoss(amount, updating = TRUE) + if(status_flags & GODMODE) + return FALSE + var/old_stamloss = staminaloss + staminaloss = amount + if(old_stamloss == staminaloss) + updating = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_STAMINA + if(updating) + handle_hud_icons_health() + update_stamina() + +/mob/living/proc/getMaxHealth() + return maxHealth + +/mob/living/proc/setMaxHealth(var/newMaxHealth) + maxHealth = newMaxHealth + + + +// heal ONE external organ, organ gets randomly selected from damaged ones. +/mob/living/proc/heal_organ_damage(brute, burn, updating_health = TRUE) + adjustBruteLoss(-brute, FALSE) + adjustFireLoss(-burn, FALSE) + if(updating_health) + updatehealth("heal organ damage") + +// damage ONE external organ, organ gets randomly selected from damaged ones. +/mob/living/proc/take_organ_damage(brute, burn, updating_health = TRUE) + if(status_flags & GODMODE) + return FALSE //godmode + adjustBruteLoss(brute, FALSE) + adjustFireLoss(burn, FALSE) + if(updating_health) + updatehealth("take organ damage") + +// heal MANY external organs, in random order +/mob/living/proc/heal_overall_damage(brute, burn, updating_health = TRUE) + adjustBruteLoss(-brute, FALSE) + adjustFireLoss(-burn, FALSE) + if(updating_health) + updatehealth("heal overall damage") + +// damage MANY external organs, in random order +/mob/living/proc/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null) + if(status_flags & GODMODE) + return FALSE //godmode + adjustBruteLoss(brute, FALSE) + adjustFireLoss(burn, FALSE) + if(updating_health) + updatehealth("take overall damage") + +/mob/living/proc/has_organic_damage() + return (maxHealth - health) diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 9056a078791..7987f460815 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -1,12 +1,71 @@ +//This is the proc for gibbing a mob. Cannot gib ghosts. +//added different sort of gibs and animations. N +/mob/living/gib() + if(!death(TRUE) && stat != DEAD) + return FALSE + // hide and freeze for the GC + notransform = 1 + canmove = 0 + icon = null + invisibility = 101 + + playsound(src.loc, 'sound/goonstation/effects/gib.ogg', 50, 1) + gibs(loc, dna) + QDEL_IN(src, 0) + return TRUE + +//This is the proc for turning a mob into ash. Mostly a copy of gib code (above). +//Originally created for wizard disintegrate. I've removed the virus code since it's irrelevant here. +//Dusting robots does not eject the MMI, so it's a bit more powerful than gib() /N +/mob/living/dust() + if(!death(TRUE) && stat != DEAD) + return FALSE + new /obj/effect/decal/cleanable/ash(loc) + // hide and freeze them while they get GC'd + notransform = 1 + canmove = 0 + icon = null + invisibility = 101 + QDEL_IN(src, 0) + return TRUE + +/mob/living/melt() + if(!death(TRUE) && stat != DEAD) + return FALSE + // hide and freeze them while they get GC'd + notransform = 1 + canmove = 0 + icon = null + invisibility = 101 + QDEL_IN(src, 0) + return TRUE + +/mob/living/proc/can_die() + return !(stat == DEAD || (status_flags & GODMODE)) + +// Returns true if mob transitioned from live to dead +// Do a check with `can_die` beforehand if you need to do any +// handling before `stat` is set /mob/living/death(gibbed) - blinded = max(blinded, 1) + if(!can_die()) + // Whew! Good thing I'm indestructible! (or already dead) + return FALSE + + stat = DEAD + SetDizzy(0) + SetJitter(0) + SetLoseBreath(0) if(suiciding) mind.suicided = TRUE - clear_fullscreens() + update_sight() update_action_buttons_icon() + med_hud_set_health() + med_hud_set_status() + callHook("death", list(src, gibbed)) + for(var/s in ownedSoullinks) var/datum/soullink/S = s S.ownerDies(gibbed, src) @@ -14,7 +73,19 @@ var/datum/soullink/S = s S.sharerDies(gibbed, src) - med_hud_set_health() - med_hud_set_status() + if(!gibbed) + update_canmove() - ..(gibbed) + timeofdeath = world.time + + living_mob_list -= src + dead_mob_list += src + if(mind) + mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) + respawnable_list += src + + if(ticker && ticker.mode) + ticker.mode.check_win() + + // u no we dead + return TRUE diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index f02065b3a0a..032f46d42dd 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -8,12 +8,6 @@ return var/datum/gas_mixture/environment = loc.return_air() - //Apparently, the person who wrote this code designed it so that - //blinded get reset each cycle and then get activated later in the - //code. Very ugly. I dont care. Moving this stuff here so its easy - //to find it. - blinded = null - if(stat != DEAD) //Chemicals in the body handle_chemicals_in_body() @@ -51,8 +45,6 @@ handle_disabilities() // eye, ear, brain damages handle_status_effects() //all special effects, stunned, weakened, jitteryness, hallucination, sleeping, etc - update_canmove(1) // set to 1 to not update icon action buttons; rip this argument out if Life is ever refactored to be non-stupid. -Fox - if(client) //regular_hud_updates() //THIS DOESN'T FUCKING UPDATE SHIT handle_regular_hud_updates() //IT JUST REMOVES FUCKING HUD IMAGES @@ -90,21 +82,7 @@ //This updates the health and status of the mob (conscious, unconscious, dead) /mob/living/proc/handle_regular_status_updates() - - updatehealth() - - if(stat != DEAD) - - if(paralysis) - stat = UNCONSCIOUS - - else if(status_flags & FAKEDEATH) - stat = UNCONSCIOUS - - else - stat = CONSCIOUS - - return 1 + return stat != DEAD //this updates all special effects: stunned, sleeping, weakened, druggy, stuttering, etc.. /mob/living/proc/handle_status_effects() @@ -215,29 +193,6 @@ if(stat == DEAD) return - if(blinded || eye_blind) - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - throw_alert("blind", /obj/screen/alert/blind) - else - clear_fullscreen("blind") - clear_alert("blind") - - if(disabilities & NEARSIGHTED) - overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1) - else - clear_fullscreen("nearsighted") - - if(eye_blurry) - overlay_fullscreen("blurry", /obj/screen/fullscreen/blurry) - else - clear_fullscreen("blurry") - - if(druggy) - overlay_fullscreen("high", /obj/screen/fullscreen/high) - throw_alert("high", /obj/screen/alert/high) - else - clear_fullscreen("high") - clear_alert("high") if(machine) if(!machine.check_eye(src)) @@ -247,6 +202,8 @@ reset_perspective(null) /mob/living/proc/update_sight() + if(stat == DEAD) + grant_death_vision() return // Gives a mob the vision of being dead diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 4cfdc7bb1f4..fdd91bf1cd9 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -214,16 +214,14 @@ /mob/living/verb/succumb() set hidden = 1 if(InCritical()) - attack_log += "[src] has ["succumbed to death"] with [round(health, 0.1)] points of health!" + create_attack_log("[src] has ["succumbed to death"] with [round(health, 0.1)] points of health!") adjustOxyLoss(health - config.health_threshold_dead) - updatehealth() // super check for weird mobs, including ones that adjust hp // we don't want to go overboard and gib them, though for(var/i = 1 to 5) if(health < config.health_threshold_dead) break take_overall_damage(max(5, health - config.health_threshold_dead), 0) - updatehealth() to_chat(src, "You have given up life and succumbed to death.") /mob/living/proc/InCritical() @@ -233,12 +231,15 @@ ..() flash_eyes() -/mob/living/proc/updatehealth() +/mob/living/proc/updatehealth(reason = "none given") if(status_flags & GODMODE) health = maxHealth stat = CONSCIOUS return health = maxHealth - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - getCloneLoss() + + update_stat("updatehealth([reason])") + handle_hud_icons_health() med_hud_set_health() @@ -268,89 +269,6 @@ return temperature -// ++++ROCKDTBEN++++ MOB PROCS -- Ask me before touching. -// Stop! ... Hammertime! ~Carn -// I touched them without asking... I'm soooo edgy ~Erro (added nodamage checks) -// no ~Tigerkitty - -/mob/living/proc/getBruteLoss() - return bruteloss - -/mob/living/proc/adjustBruteLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - bruteloss = min(max(bruteloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/getOxyLoss() - return oxyloss - -/mob/living/proc/adjustOxyLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - oxyloss = min(max(oxyloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/setOxyLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - oxyloss = amount - -/mob/living/proc/getToxLoss() - return toxloss - -/mob/living/proc/adjustToxLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - toxloss = min(max(toxloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/setToxLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - toxloss = amount - -/mob/living/proc/getFireLoss() - return fireloss - -/mob/living/proc/adjustFireLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - fireloss = min(max(fireloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/getCloneLoss() - return cloneloss - -/mob/living/proc/adjustCloneLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - cloneloss = min(max(cloneloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/setCloneLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - cloneloss = amount - -/mob/living/proc/getBrainLoss() - return brainloss - -/mob/living/proc/adjustBrainLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - brainloss = min(max(brainloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/setBrainLoss(var/amount) - if(status_flags & GODMODE) return 0 //godmode - brainloss = amount - -/mob/living/proc/getStaminaLoss() - return staminaloss - -/mob/living/proc/adjustStaminaLoss(var/amount) - if(status_flags & GODMODE) return 0 - staminaloss = min(max(staminaloss + amount, 0),(maxHealth*2)) - -/mob/living/proc/setStaminaLoss(var/amount) - if(status_flags & GODMODE) return 0 - staminaloss = amount - -/mob/living/proc/getMaxHealth() - return maxHealth - -/mob/living/proc/setMaxHealth(var/newMaxHealth) - maxHealth = newMaxHealth - -// ++++ROCKDTBEN++++ MOB PROCS //END - - /mob/proc/get_contents() @@ -421,35 +339,6 @@ var/obj/item/organ/external/def_zone = ran_zone(t) return def_zone -// heal ONE external organ, organ gets randomly selected from damaged ones. -/mob/living/proc/heal_organ_damage(var/brute, var/burn) - adjustBruteLoss(-brute) - adjustFireLoss(-burn) - updatehealth() - -// damage ONE external organ, organ gets randomly selected from damaged ones. -/mob/living/proc/take_organ_damage(var/brute, var/burn) - if(status_flags & GODMODE) return 0 //godmode - adjustBruteLoss(brute) - adjustFireLoss(burn) - updatehealth() - -// heal MANY external organs, in random order -/mob/living/proc/heal_overall_damage(var/brute, var/burn) - adjustBruteLoss(-brute) - adjustFireLoss(-burn) - updatehealth() - -// damage MANY external organs, in random order -/mob/living/proc/take_overall_damage(var/brute, var/burn, var/used_weapon = null) - if(status_flags & GODMODE) return 0 //godmode - adjustBruteLoss(brute) - adjustFireLoss(burn) - updatehealth() - -/mob/living/proc/has_organic_damage() - return (maxHealth - health) - /mob/living/proc/restore_all_organs() return @@ -474,6 +363,8 @@ C.reagents.clear_reagents() C.reagents.addiction_list.Cut() +// rejuvenate: Called by `revive` to get the mob into a revivable state +// the admin "rejuvenate" command calls `revive`, not this proc. /mob/living/proc/rejuvenate() var/mob/living/carbon/human/human_mob = null //Get this declared for use later. @@ -496,7 +387,6 @@ radiation = 0 SetDruggy(0) SetHallucinate(0) - blinded = 0 nutrition = NUTRITION_LEVEL_FED + 50 bodytemperature = 310 CureBlind() @@ -544,11 +434,10 @@ restore_all_organs() surgeries.Cut() //End all surgeries. if(stat == DEAD) - dead_mob_list -= src - living_mob_list += src - timeofdeath = 0 + update_revive() + else if(stat == UNCONSCIOUS) + WakeUp() - stat = CONSCIOUS update_fire() regenerate_icons() restore_blood() diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index aaeb26fe2c6..ed6ef267fb0 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -122,7 +122,7 @@ M.mech_toxin_damage(src) else return - updatehealth() + updatehealth("mech melee attack") M.occupant_message("You hit [src].") visible_message("[src] has been hit by [M.name].", \ "[src] has been hit by [M.name].") diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 4afdd9281ce..44d34516ab0 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -12,7 +12,6 @@ var/toxloss = 0 //Toxic damage caused by being poisoned or radiated var/fireloss = 0 //Burn damage caused by being way too hot, too cold or burnt. var/cloneloss = 0 //Damage caused by being cloned or ejected from the cloner early. slimes also deal cloneloss damage to victims - var/brainloss = 0 //'Retardation' damage caused by someone hitting you in the head with a bible or being infected with brainrot. var/staminaloss = 0 //Stamina damage, or exhaustion. You recover it slowly naturally, and are stunned if it gets too high. Holodeck and hallucinations deal this. @@ -67,4 +66,3 @@ hud_possible = list(HEALTH_HUD,STATUS_HUD,SPECIALROLE_HUD) var/list/status_effects //a list of all status effects the mob has - diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index a2fc8e934cb..57e5623cbbf 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -2,6 +2,8 @@ ..() //Mind updates sync_mind() + update_stat("mob login") + update_sight() //If they're SSD, remove it so they can wake back up. player_logged = 0 @@ -11,8 +13,8 @@ to_chat(src, "You can ventcrawl! Use alt+click on vents to quickly travel about the station.") if(ranged_ability) - ranged_ability.add_ranged_ability(src, "You currently have [ranged_ability] active!") - + ranged_ability.add_ranged_ability(src, "You currently have [ranged_ability] active!") + //Should update regardless of if we can ventcrawl, since we can end up in pipes in other ways. update_pipe_vision() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 2c4b4612e5f..daf723597de 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -549,7 +549,6 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/blob_act() if(stat != 2) adjustBruteLoss(60) - updatehealth() return TRUE return FALSE @@ -685,7 +684,6 @@ var/list/ai_verbs_default = list( /mob/living/silicon/ai/bullet_act(var/obj/item/projectile/Proj) ..(Proj) - updatehealth() return 2 /mob/living/silicon/ai/reset_perspective(atom/A) diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index 553af6f09b8..ca4d2da70bd 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -1,19 +1,16 @@ /mob/living/silicon/ai/death(gibbed) - if(stat == DEAD) - return - stat = DEAD + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE if(custom_sprite == 1)//check for custom AI sprite, defaulting to blue screen if no. icon_state = "[ckey]-ai_dead" else if("[icon_state]_dead" in icon_states(icon,1)) icon_state = "[icon_state]_dead" else icon_state = "ai_dead" - update_canmove() if(eyeobj) eyeobj.setLoc(get_turf(src)) - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO shuttle_caller_list -= src SSshuttle.autoEvac() @@ -38,12 +35,7 @@ explosion(src.loc, 3, 6, 12, 15) for(var/obj/machinery/ai_status_display/O in world) //change status - spawn( 0 ) O.mode = 2 - if(istype(loc, /obj/item/aicard)) - loc.icon_state = "aicard-404" - timeofdeath = world.time - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) - - return ..(gibbed) + if(istype(loc, /obj/item/aicard)) + loc.icon_state = "aicard-404" diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 42f132e39d4..c3b22129cb8 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -14,13 +14,11 @@ reset_perspective(null) unset_machine() - updatehealth() + updatehealth("life") + if(stat == DEAD) + return update_gravity(mob_has_gravity()) - if(health <= config.health_threshold_dead) - death() - return 0 - if(!eyeobj || QDELETED(eyeobj) || !eyeobj.loc) view_core() @@ -44,21 +42,15 @@ var/area/my_area = get_area(src) if(!lacks_power()) - if(aiRestorePowerRoutine == 2) - to_chat(src, "Alert cancelled. Power has been restored without our assistance.") + if(aiRestorePowerRoutine > 1) + update_blind_effects() aiRestorePowerRoutine = 0 - clear_fullscreen("blind") - update_sight() - else if(aiRestorePowerRoutine == 3) - to_chat(src, "Alert cancelled. Power has been restored.") - aiRestorePowerRoutine = 0 - clear_fullscreen("blind") update_sight() + to_chat(src, "Alert cancelled. Power has been restored[aiRestorePowerRoutine == 2 ? "without our assistance" : ""].") else - overlay_fullscreen("blind", /obj/screen/fullscreen/blind) - if(lacks_power()) if(!aiRestorePowerRoutine) + update_blind_effects() aiRestorePowerRoutine = 1 update_sight() to_chat(src, "You have lost power!") @@ -73,7 +65,7 @@ if(!lacks_power()) to_chat(src, "Alert cancelled. Power has been restored without our assistance.") aiRestorePowerRoutine = 0 - clear_fullscreen("blind") + update_blind_effects() update_sight() return to_chat(src, "Fault confirmed: missing external power. Shutting down main control system to save power.") @@ -112,7 +104,7 @@ if(!lacks_power()) to_chat(src, "Alert cancelled. Power has been restored without our assistance.") aiRestorePowerRoutine = 0 - clear_fullscreen("blind") + update_blind_effects() update_sight() return @@ -143,12 +135,13 @@ if(get_nations_mode()) process_nations_ai() -/mob/living/silicon/ai/updatehealth() +/mob/living/silicon/ai/updatehealth(reason = "none given") if(status_flags & GODMODE) health = 100 stat = CONSCIOUS else health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() + update_stat("updatehealth([reason])") diag_hud_set_status() diag_hud_set_health() diff --git a/code/modules/mob/living/silicon/ai/update_status.dm b/code/modules/mob/living/silicon/ai/update_status.dm index 4fa060abf39..853dedbd6c0 100644 --- a/code/modules/mob/living/silicon/ai/update_status.dm +++ b/code/modules/mob/living/silicon/ai/update_status.dm @@ -1,10 +1,15 @@ -/mob/living/silicon/ai/update_stat() +/mob/living/silicon/ai/update_stat(reason = "none given") if(status_flags & GODMODE) return if(stat != DEAD) if(health <= config.health_threshold_dead) death() + create_debug_log("died of damage, trigger reason: [reason]") return else if(stat == UNCONSCIOUS) WakeUp() + create_debug_log("woke up, trigger reason: [reason]") //diag_hud_set_status() + +/mob/living/silicon/ai/has_vision() + return ..() && !lacks_power() diff --git a/code/modules/mob/living/silicon/decoy/death.dm b/code/modules/mob/living/silicon/decoy/death.dm index 624343af464..46a60822aa8 100644 --- a/code/modules/mob/living/silicon/decoy/death.dm +++ b/code/modules/mob/living/silicon/decoy/death.dm @@ -1,10 +1,10 @@ /mob/living/silicon/decoy/death(gibbed) - if(stat == DEAD) - return - stat = DEAD + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE icon_state = "ai-crash" for(var/obj/machinery/ai_status_display/O in world) //change status if(atoms_share_level(O, src)) O.mode = 2 - ..(0) - gib() \ No newline at end of file + gib() diff --git a/code/modules/mob/living/silicon/decoy/life.dm b/code/modules/mob/living/silicon/decoy/life.dm index dc1324dc6dd..b8919373faf 100644 --- a/code/modules/mob/living/silicon/decoy/life.dm +++ b/code/modules/mob/living/silicon/decoy/life.dm @@ -2,17 +2,18 @@ return -/mob/living/silicon/decoy/updatehealth() +/mob/living/silicon/decoy/updatehealth(reason = "none given") if(status_flags & GODMODE) health = 100 stat = CONSCIOUS else health = 100 - getOxyLoss() - getToxLoss() - getFireLoss() - getBruteLoss() - update_stat() + update_stat("updatehealth([reason])") -/mob/living/silicon/decoy/update_stat() +/mob/living/silicon/decoy/update_stat(reason = "none given") if(stat == DEAD) return if(health <= 0) - death() \ No newline at end of file + death() + create_debug_log("died of damage, trigger reason: [reason]") diff --git a/code/modules/mob/living/silicon/pai/death.dm b/code/modules/mob/living/silicon/pai/death.dm index b0f498014d8..48539a9689b 100644 --- a/code/modules/mob/living/silicon/pai/death.dm +++ b/code/modules/mob/living/silicon/pai/death.dm @@ -1,28 +1,17 @@ /mob/living/silicon/pai/death(gibbed, cleanWipe) - if(stat == DEAD) - return + if(can_die()) + if(!cleanWipe) + force_fold_out() - if(!cleanWipe) - force_fold_out() + visible_message("[src] emits a dull beep before it loses power and collapses.", "You hear a dull beep followed by the sound of glass crunching.") + name = "pAI debris" + desc = "The unfortunate remains of some poor personal AI device." + icon_state = "[chassis]_dead" - var/turf/T = get_turf_or_move(loc) - for(var/mob/M in viewers(T)) - M.show_message("[src] emits a dull beep before it loses power and collapses.", 3, "You hear a dull beep followed by the sound of glass crunching.", 2) - name = "pAI debris" - desc = "The unfortunate remains of some poor personal AI device." - icon_state = "[chassis]_dead" - stat = DEAD - canmove = 0 - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE - //var/tod = time2text(world.realtime,"hh:mm:ss") //weasellos time of death patch - //mind.store_memory("Time of death: [tod]", 0) - - //New pAI's get a brand new mind to prevent meta stuff from their previous life. This new mind causes problems down the line if it's not deleted here. - //Read as: I have no idea what I'm doing but asking for help got me nowhere so this is what you get. - Nodrak - if(mind) qdel(mind) - living_mob_list -= src if(icon_state != "[chassis]_dead" || cleanWipe) qdel(src) diff --git a/code/modules/mob/living/silicon/pai/life.dm b/code/modules/mob/living/silicon/pai/life.dm index abcfc6bd643..0abaa12bdd9 100644 --- a/code/modules/mob/living/silicon/pai/life.dm +++ b/code/modules/mob/living/silicon/pai/life.dm @@ -18,11 +18,10 @@ qdel(src.cable) cable = null -/mob/living/silicon/pai/updatehealth() +/mob/living/silicon/pai/updatehealth(reason = "none given") if(status_flags & GODMODE) health = 100 stat = CONSCIOUS else health = 100 - getBruteLoss() - getFireLoss() - if(health <= 0) - death(0) \ No newline at end of file + update_stat("updatehealth([reason])") diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index d635422073f..210aeadb7ee 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -160,9 +160,8 @@ return 1 /mob/living/silicon/pai/blob_act() - if(stat != 2) + if(stat != DEAD) adjustBruteLoss(60) - updatehealth() return 1 return 0 @@ -238,7 +237,6 @@ var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) add_attack_logs(M, src, "Animal attacked for [damage] damage") adjustBruteLoss(damage) - updatehealth() /mob/living/silicon/pai/proc/switchCamera(var/obj/machinery/camera/C) usr:cameraFollow = null @@ -454,9 +452,7 @@ if(stat == DEAD) to_chat(user, "\The [src] is beyond help, at this point.") else if(getBruteLoss() || getFireLoss()) - adjustBruteLoss(-15) - adjustFireLoss(-15) - updatehealth() + heal_overall_damage(15, 15) N.use(1) user.visible_message("[user.name] applied some [W] at [src]'s damaged areas.",\ "You apply some [W] at [name]'s damaged areas.") @@ -467,7 +463,6 @@ else if(W.force) visible_message("[user.name] attacks [src] with [W]!") adjustBruteLoss(W.force) - updatehealth() else visible_message("[user.name] bonks [src] harmlessly with [W].") spawn(1) @@ -557,7 +552,6 @@ /mob/living/silicon/pai/bullet_act(var/obj/item/projectile/Proj) ..(Proj) - updatehealth() if(stat != 2) spawn(1) close_up() diff --git a/code/modules/mob/living/silicon/pai/update_status.dm b/code/modules/mob/living/silicon/pai/update_status.dm index 155ecc84a28..110b645c11f 100644 --- a/code/modules/mob/living/silicon/pai/update_status.dm +++ b/code/modules/mob/living/silicon/pai/update_status.dm @@ -1,3 +1,4 @@ -/mob/living/silicon/pai/update_stat() +/mob/living/silicon/pai/update_stat(reason = "none given") if(health <= 0) death(gibbed = 0) + create_debug_log("died of damage, trigger reason: [reason]") diff --git a/code/modules/mob/living/silicon/robot/component.dm b/code/modules/mob/living/silicon/robot/component.dm index dfdaac8015c..69cf6f93872 100644 --- a/code/modules/mob/living/silicon/robot/component.dm +++ b/code/modules/mob/living/silicon/robot/component.dm @@ -21,7 +21,9 @@ src.owner = R /datum/robot_component/proc/install() + go_online() /datum/robot_component/proc/uninstall() + go_offline() /datum/robot_component/proc/destroy() if(wrapped) @@ -34,34 +36,62 @@ installed = -1 uninstall() -/datum/robot_component/proc/take_damage(brute, electronics, sharp) +/datum/robot_component/proc/take_damage(brute, electronics, sharp, updating_health = TRUE) if(installed != 1) return + if(owner && updating_health) + owner.updatehealth("component '[src]' take damage") + brute_damage += brute electronics_damage += electronics if(brute_damage + electronics_damage >= max_damage) destroy() -/datum/robot_component/proc/heal_damage(brute, electronics) +/datum/robot_component/proc/heal_damage(brute, electronics, updating_health = TRUE) if(installed != 1) // If it's not installed, can't repair it. return 0 + if(owner && updating_health) + owner.updatehealth("component '[src]' heal damage") + brute_damage = max(0, brute_damage - brute) electronics_damage = max(0, electronics_damage - electronics) /datum/robot_component/proc/is_powered() return (installed == 1) && (brute_damage + electronics_damage < max_damage) && (powered) - /datum/robot_component/proc/consume_power() if(toggled == 0) powered = 0 return powered = 1 +/datum/robot_component/proc/disable() + if(!component_disabled) + go_offline() + component_disabled++ + +/datum/robot_component/proc/enable() + component_disabled-- + if(!component_disabled) + go_online() + +/datum/robot_component/proc/toggle() + toggled = !toggled + if(toggled) + go_online() + else + go_offline() + +/datum/robot_component/proc/go_online() + return + +/datum/robot_component/proc/go_offline() + return + /datum/robot_component/armour name = "armour plating" external_type = /obj/item/robot_parts/robot_component/armour @@ -72,10 +102,25 @@ external_type = /obj/item/robot_parts/robot_component/actuator max_damage = 50 +/datum/robot_component/actuator/go_online() + owner.update_stat() + +/datum/robot_component/actuator/go_offline() + owner.update_stat() + /datum/robot_component/cell name = "power cell" max_damage = 50 +/datum/robot_component/cell/is_powered() + return ..() && owner.cell + +/datum/robot_component/cell/go_online() + owner.update_stat() + +/datum/robot_component/cell/go_offline() + owner.update_stat() + /datum/robot_component/cell/destroy() ..() owner.cell = null @@ -95,6 +140,14 @@ external_type = /obj/item/robot_parts/robot_component/camera max_damage = 40 +/datum/robot_component/camera/go_online() + owner.update_blind_effects() + owner.update_sight() + +/datum/robot_component/camera/go_offline() + owner.update_blind_effects() + owner.update_sight() + /datum/robot_component/diagnosis_unit name = "self-diagnosis unit" external_type = /obj/item/robot_parts/robot_component/diagnosis_unit @@ -117,9 +170,9 @@ /mob/living/silicon/robot/proc/disable_component(module_name, duration) var/datum/robot_component/D = get_component(module_name) - D.component_disabled++ + D.disable() spawn(duration) - D.component_disabled-- + D.enable() // Returns component by it's string name /mob/living/silicon/robot/proc/get_component(var/component_name) @@ -154,6 +207,8 @@ name = "camera" icon_state = "camera" + + /obj/item/robot_parts/robot_component/diagnosis_unit name = "diagnosis unit" icon_state = "diagnosis_unit" diff --git a/code/modules/mob/living/silicon/robot/death.dm b/code/modules/mob/living/silicon/robot/death.dm index 82667be2d3d..f9432ab7836 100644 --- a/code/modules/mob/living/silicon/robot/death.dm +++ b/code/modules/mob/living/silicon/robot/death.dm @@ -46,11 +46,20 @@ /mob/living/silicon/robot/death(gibbed) - if(stat == DEAD) return - if(!gibbed) - emote("deathgasp") - stat = DEAD - update_canmove() + if(can_die()) + if(!gibbed) + emote("deathgasp") + + if(module) + module.handle_death(gibbed) + + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE + + diag_hud_set_status() + diag_hud_set_health() if(camera) camera.status = 0 update_headlamp(1) //So borg lights are disabled when killed. @@ -59,13 +68,6 @@ var/obj/machinery/recharge_station/RC = loc RC.go_out() - sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS - see_in_dark = 8 - see_invisible = SEE_INVISIBLE_LEVEL_TWO update_icons() - timeofdeath = world.time - if(mind) mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0) sql_report_cyborg_death(src) - - return ..(gibbed) diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm index aaaeb15b283..eb1596c55c6 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone.dm @@ -215,33 +215,13 @@ //DRONE LIFE/DEATH //For some goddamn reason robots have this hardcoded. Redefining it for our fragile friends here. -/mob/living/silicon/robot/drone/updatehealth() +/mob/living/silicon/robot/drone/updatehealth(reason = "none given") if(status_flags & GODMODE) health = 35 stat = CONSCIOUS return health = 35 - (getBruteLoss() + getFireLoss()) - return - -//Easiest to check this here, then check again in the robot proc. -//Standard robots use config for crit, which is somewhat excessive for these guys. -//Drones killed by damage will gib. -/mob/living/silicon/robot/drone/handle_regular_status_updates() - - if(health <= -35 && src.stat != DEAD) - timeofdeath = world.time - death() //Possibly redundant, having trouble making death() cooperate. - gib() - return - return ..() // If you don't return anything here, you won't update status effects, like weakening - -/mob/living/silicon/robot/drone/death(gibbed) - - if(module) - var/obj/item/gripper/G = locate(/obj/item/gripper) in module - if(G) G.drop_item() - - ..(gibbed) + update_stat("updatehealth([reason])") //CONSOLE PROCS diff --git a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm index 57ffc898873..1ca0ecbfbbc 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm @@ -1,24 +1,28 @@ //Redefining some robot procs, since drones can't be repaired and really shouldn't take component damage. -/mob/living/silicon/robot/drone/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null) +/mob/living/silicon/robot/drone/take_overall_damage(brute, burn, updating_health = TRUE, used_weapon = null, sharp = 0) bruteloss += brute fireloss += burn + if(updating_health) + updatehealth("take overall damage") -/mob/living/silicon/robot/drone/heal_overall_damage(var/brute, var/burn) +/mob/living/silicon/robot/drone/heal_overall_damage(brute, burn, updating_health = TRUE) bruteloss -= brute fireloss -= burn if(bruteloss<0) bruteloss = 0 if(fireloss<0) fireloss = 0 + if(updating_health) + updatehealth("heal overall damage") -/mob/living/silicon/robot/drone/take_organ_damage(var/brute = 0, var/burn = 0, var/sharp = 0) - take_overall_damage(brute,burn) +/mob/living/silicon/robot/drone/take_organ_damage(brute, burn, updating_health = TRUE, sharp = 0) + take_overall_damage(brute,burn, updating_health, null, sharp) -/mob/living/silicon/robot/drone/heal_organ_damage(var/brute, var/burn) - heal_overall_damage(brute,burn) +/mob/living/silicon/robot/drone/heal_organ_damage(brute, burn, updating_health = TRUE) + heal_overall_damage(brute,burn, updating_health) /mob/living/silicon/robot/drone/getFireLoss() return fireloss /mob/living/silicon/robot/drone/getBruteLoss() - return bruteloss \ No newline at end of file + return bruteloss diff --git a/code/modules/mob/living/silicon/robot/drone/update_status.dm b/code/modules/mob/living/silicon/robot/drone/update_status.dm index 97d2214c2e2..80eac952966 100644 --- a/code/modules/mob/living/silicon/robot/drone/update_status.dm +++ b/code/modules/mob/living/silicon/robot/drone/update_status.dm @@ -1,10 +1,11 @@ //Easiest to check this here, then check again in the robot proc. //Standard robots use config for crit, which is somewhat excessive for these guys. //Drones killed by damage will gib. -/mob/living/silicon/robot/drone/update_stat() +/mob/living/silicon/robot/drone/update_stat(reason = "none given") if(status_flags & GODMODE) return if(health <= -35 && stat != DEAD) gib() + create_debug_log("died of damage, trigger reason: [reason]") return - return ..() + return ..(reason) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index afa10c1772b..752cdc0f631 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -21,22 +21,22 @@ /mob/living/silicon/robot/proc/handle_robot_cell() if(stat != DEAD) - if(!is_component_functioning("power cell") || !cell) - Paralyse(2) + if(!is_component_functioning("power cell")) uneq_all() low_power_mode = 1 update_headlamp() diag_hud_set_borgcell() return if(low_power_mode) - if(is_component_functioning("power cell") && cell && cell.charge) + if(is_component_functioning("power cell") && cell.charge) low_power_mode = 0 update_headlamp() else if(stat == CONSCIOUS) use_power() /mob/living/silicon/robot/proc/use_power() - if(is_component_functioning("power cell") && cell && cell.charge) + // this check is safe because `cell` is guaranteed to be set when the power cell is functioning + if(is_component_functioning("power cell") && cell.charge) if(cell.charge <= 100) uneq_all() var/amt = Clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell. @@ -57,22 +57,10 @@ else camera.status = 1 - if(getOxyLoss() > 50) - Paralyse(3) - if(sleeping) - Paralyse(3) AdjustSleeping(-1) - if(resting) - Weaken(5) - if(.) //alive - if(health <= config.health_threshold_dead) - death() - diag_hud_set_status() - return - if(!istype(src, /mob/living/silicon/robot/drone)) if(health < 50) //Gradual break down of modules as more damage is sustained if(uneq_module(module_state_3)) @@ -86,19 +74,8 @@ if(uneq_module(module_state_1)) to_chat(src, "CRITICAL ERROR: All modules OFFLINE.") - if(paralysis || stunned || weakened) - stat = UNCONSCIOUS - - if(!paralysis > 0) - SetEyeBlind(0) - - else - stat = CONSCIOUS - diag_hud_set_health() diag_hud_set_status() - else //dead - SetEyeBlind(0) //update the state of modules and components here if(stat != CONSCIOUS) @@ -109,14 +86,6 @@ else radio.on = 1 - if(is_component_functioning("camera") && stat == CONSCIOUS) - blinded = 0 - else - blinded = 1 - - if(!is_component_functioning("actuator")) - Paralyse(3) - return 1 /mob/living/silicon/robot/update_sight() @@ -234,7 +203,7 @@ weaponlock_time = 120 /mob/living/silicon/robot/update_canmove(delay_action_updates = 0) - if(paralysis || stunned || weakened || buckled || lockcharge) + if(paralysis || stunned || weakened || buckled || lockcharge || stat) canmove = 0 else canmove = 1 diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index b9a7d0d12a0..d2e065d3b8d 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -477,12 +477,8 @@ var/list/robot_verbs_default = list( return var/datum/robot_component/C = components[toggle] - if(C.toggled) - C.toggled = 0 - to_chat(src, "You disable [C.name].") - else - C.toggled = 1 - to_chat(src, "You enable [C.name].") + C.toggle() + to_chat(src, "You [C.toggled ? "enable" : "disable"] [C.name].") /mob/living/silicon/robot/proc/sensor_mode() set name = "Set Sensor Augmentation" @@ -528,9 +524,8 @@ var/list/robot_verbs_default = list( thruster_button.icon_state = "ionpulse[ionpulse_on]" /mob/living/silicon/robot/blob_act() - if(stat != 2) + if(stat != DEAD) adjustBruteLoss(60) - updatehealth() return 1 else gib() @@ -573,7 +568,6 @@ var/list/robot_verbs_default = list( /mob/living/silicon/robot/bullet_act(var/obj/item/projectile/Proj) ..(Proj) - updatehealth() if(prob(75) && Proj.damage > 0) spark_system.start() return 2 @@ -609,7 +603,6 @@ var/list/robot_verbs_default = list( if(WT.remove_fuel(0)) playsound(src.loc, W.usesound, 50, 1) adjustBruteLoss(-30) - updatehealth() add_fingerprint(user) user.visible_message("\The [user] patches some dents on \the [src] with \the [WT].") else @@ -1259,7 +1252,9 @@ var/list/robot_verbs_default = list( /mob/living/silicon/robot/adjustOxyLoss(var/amount) if(suiciding) - ..() + return ..() + else + return STATUS_UPDATE_NONE /mob/living/silicon/robot/regenerate_icons() ..() @@ -1439,6 +1434,7 @@ var/list/robot_verbs_default = list( disable_component("comms", 160) if(2) disable_component("comms", 60) + /mob/living/silicon/robot/rejuvenate() ..() var/brute = 1000 diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm index f84696c9964..ef7734c1e0d 100644 --- a/code/modules/mob/living/silicon/robot/robot_damage.dm +++ b/code/modules/mob/living/silicon/robot/robot_damage.dm @@ -1,17 +1,12 @@ -/mob/living/silicon/robot/updatehealth() +/mob/living/silicon/robot/updatehealth(reason = "none given") if(status_flags & GODMODE) health = maxHealth stat = CONSCIOUS return health = maxHealth - (getOxyLoss() + getFireLoss() + getBruteLoss()) - if(stat == DEAD && health > 0) - update_revive() - var/mob/dead/observer/ghost = get_ghost() - if(ghost) - to_chat(ghost, "Your cyborg shell has been repaired, re-enter if you want to continue! (Verbs -> Ghost -> Re-enter corpse)") - ghost << sound('sound/effects/genetics.ogg') - return - + update_stat("updatehealth([reason])") + handle_hud_icons_health() + diag_hud_set_health() /mob/living/silicon/robot/getBruteLoss() var/amount = 0 @@ -27,17 +22,19 @@ if(C.installed != 0) amount += C.electronics_damage return amount -/mob/living/silicon/robot/adjustBruteLoss(var/amount) +/mob/living/silicon/robot/adjustBruteLoss(amount, updating_health = TRUE) if(amount > 0) - take_overall_damage(amount, 0) + take_overall_damage(amount, 0, updating_health) else - heal_overall_damage(-amount, 0) + heal_overall_damage(-amount, 0, updating_health) + return STATUS_UPDATE_HEALTH -/mob/living/silicon/robot/adjustFireLoss(var/amount) +/mob/living/silicon/robot/adjustFireLoss(amount, updating_health = TRUE) if(amount > 0) - take_overall_damage(0, amount) + take_overall_damage(0, amount, updating_health) else - heal_overall_damage(0, -amount) + heal_overall_damage(0, -amount, updating_health) + return STATUS_UPDATE_HEALTH /mob/living/silicon/robot/proc/get_damaged_components(var/brute, var/burn, var/get_all) var/list/datum/robot_component/parts = list() @@ -62,13 +59,13 @@ return C return 0 -/mob/living/silicon/robot/heal_organ_damage(var/brute, var/burn) +/mob/living/silicon/robot/heal_organ_damage(brute, burn, updating_health = TRUE) var/list/datum/robot_component/parts = get_damaged_components(brute,burn) if(!parts.len) return var/datum/robot_component/picked = pick(parts) - picked.heal_damage(brute,burn) + picked.heal_damage(brute,burn, updating_health) -/mob/living/silicon/robot/take_organ_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/edge = 0) +/mob/living/silicon/robot/take_organ_damage(brute = 0, burn = 0, updating_health = TRUE, sharp = 0, edge = 0) var/list/components = get_damageable_components() if(!components.len) return @@ -98,13 +95,13 @@ var/datum/robot_component/armour/A = get_armour() if(A) - A.take_damage(brute, burn, sharp) + A.take_damage(brute, burn, sharp, updating_health) return var/datum/robot_component/C = pick(components) - C.take_damage(brute, burn, sharp) + C.take_damage(brute, burn, sharp, updating_health) -/mob/living/silicon/robot/heal_overall_damage(var/brute, var/burn) +/mob/living/silicon/robot/heal_overall_damage(var/brute, var/burn, updating_health = TRUE) var/list/datum/robot_component/parts = get_damaged_components(brute,burn) while(parts.len && (brute>0 || burn>0) ) @@ -113,14 +110,14 @@ var/brute_was = picked.brute_damage var/burn_was = picked.electronics_damage - picked.heal_damage(brute,burn) + picked.heal_damage(brute,burn, updating_health) brute -= (brute_was-picked.brute_damage) burn -= (burn_was-picked.electronics_damage) parts -= picked -/mob/living/silicon/robot/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null) +/mob/living/silicon/robot/take_overall_damage(brute = 0, burn = 0, updating_health = TRUE, used_weapon = null, sharp = 0) if(status_flags & GODMODE) return //godmode var/list/datum/robot_component/parts = get_damageable_components() @@ -158,9 +155,10 @@ var/brute_was = picked.brute_damage var/burn_was = picked.electronics_damage - picked.take_damage(brute, burn) + picked.take_damage(brute, burn, sharp, FALSE) brute -= (picked.brute_damage - brute_was) burn -= (picked.electronics_damage - burn_was) parts -= picked + updatehealth() diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index e18ca8d6a17..161b81e3cd2 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -34,7 +34,6 @@ damage = rand(5, 35) damage = round(damage / 2) // borgs recieve half damage adjustBruteLoss(damage) - updatehealth() return /mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user) @@ -47,7 +46,7 @@ user.put_in_active_hand(cell) to_chat(user, "You remove \the [cell].") cell = null - update_icons() + update_stat() diag_hud_set_borgcell() if(!opened) diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm index 486b2a72e8f..d72220946d2 100644 --- a/code/modules/mob/living/silicon/robot/robot_modules.dm +++ b/code/modules/mob/living/silicon/robot/robot_modules.dm @@ -106,7 +106,10 @@ // Return true in an overridden subtype to prevent normal removal handling /obj/item/robot_module/proc/handle_custom_removal(component_id, mob/living/user, obj/item/W, params) - return FALSE + return FALSE + +/obj/item/robot_module/proc/handle_death(gibbed) + return /obj/item/robot_module/standard name = "standard robot module" @@ -217,6 +220,11 @@ fix_modules() +/obj/item/robot_module/engineering/handle_death() + var/obj/item/gripper/G = locate(/obj/item/gripper) in modules + if(G) + G.drop_item() + /obj/item/robot_module/security name = "security robot module" module_type = "Security" @@ -530,6 +538,12 @@ ..() + +/obj/item/robot_module/drone/handle_death() + var/obj/item/gripper/G = locate(/obj/item/gripper) in modules + if(G) + G.drop_item() + //checks whether this item is a module of the robot it is located in. /obj/item/proc/is_robot_module() if(!istype(loc, /mob/living/silicon/robot)) diff --git a/code/modules/mob/living/silicon/robot/update_status.dm b/code/modules/mob/living/silicon/robot/update_status.dm index ca755748231..352750a23ea 100644 --- a/code/modules/mob/living/silicon/robot/update_status.dm +++ b/code/modules/mob/living/silicon/robot/update_status.dm @@ -3,19 +3,38 @@ if(stat || lockcharge || weakened || stunned || paralysis || !is_component_functioning("actuator")) return TRUE -/mob/living/silicon/robot/update_stat() +/mob/living/silicon/robot/has_vision(information_only = FALSE) + return ..(information_only) && ((stat == DEAD && information_only) || is_component_functioning("camera")) + +/mob/living/silicon/robot/update_stat(reason = "none given") if(status_flags & GODMODE) return if(stat != DEAD) if(health <= -maxHealth) //die only once death() + create_debug_log("died of damage, trigger reason: [reason]") return - if(!is_component_functioning("actuator") || paralysis || sleeping || stunned || weakened || getOxyLoss() > maxHealth * 0.5) + if(!is_component_functioning("actuator") || !is_component_functioning("power cell") || paralysis || sleeping || resting || stunned || weakened || getOxyLoss() > maxHealth * 0.5) if(stat == CONSCIOUS) KnockOut() + create_debug_log("fell unconscious, trigger reason: [reason]") else if(stat == UNCONSCIOUS) WakeUp() + create_debug_log("woke up, trigger reason: [reason]") + else + if(health > 0) + update_revive() + var/mob/dead/observer/ghost = get_ghost() + if(ghost) + to_chat(ghost, "Your cyborg shell has been repaired, re-enter if you want to continue! (Verbs -> Ghost -> Re-enter corpse)") + ghost << sound('sound/effects/genetics.ogg') + create_attack_log("revived, trigger reason: [reason]") // diag_hud_set_status() // diag_hud_set_health() // update_health_hud() + +/mob/living/silicon/robot/update_revive(updating = TRUE) + . = ..(updating) + if(.) + update_icons() diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 60b1a263922..b7a64908a42 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -317,7 +317,7 @@ to_chat(src, "[A.alarm_name()]! ([(cameratext)? cameratext : "No Camera"])") /mob/living/silicon/adjustToxLoss(var/amount) - return + return STATUS_UPDATE_NONE /mob/living/silicon/get_access() return IGNORE_ACCESS //silicons always have access diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 7f5c1916619..72184f36e2f 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -202,8 +202,11 @@ return ..() /mob/living/simple_animal/bot/death(gibbed) + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE explode() - ..() /mob/living/simple_animal/bot/proc/explode() qdel(src) @@ -242,8 +245,8 @@ new /obj/effect/decal/cleanable/blood/oil(loc) return ..(amount) -/mob/living/simple_animal/bot/updatehealth() - ..() +/mob/living/simple_animal/bot/updatehealth(reason = "none given") + ..(reason) diag_hud_set_bothealth() /mob/living/simple_animal/bot/handle_automated_action() diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 007688fb7db..dc4805462fa 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -442,7 +442,7 @@ /mob/living/simple_animal/bot/medbot/examinate(atom/A as mob|obj|turf in view()) ..() - if(!is_blind(src)) + if(has_vision(information_only=TRUE)) chemscan(src, A) /mob/living/simple_animal/bot/medbot/proc/medicate_patient(mob/living/carbon/C) diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index ea7db302c43..e1d61c5aa55 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -60,9 +60,9 @@ return baby /mob/living/simple_animal/pet/cat/Runtime/death() - if(!memory_saved) + if(can_die() && !memory_saved) Write_Memory(1) - ..() + return ..() /mob/living/simple_animal/pet/cat/Runtime/proc/Read_Memory() var/savefile/S = new /savefile("data/npc_saves/Runtime.sav") @@ -176,4 +176,4 @@ atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) minbodytemp = 0 melee_damage_lower = 5 - melee_damage_upper = 15 \ No newline at end of file + melee_damage_upper = 15 diff --git a/code/modules/mob/living/simple_animal/friendly/cockroach.dm b/code/modules/mob/living/simple_animal/friendly/cockroach.dm index c0f7efca2c6..e92174bd6c2 100644 --- a/code/modules/mob/living/simple_animal/friendly/cockroach.dm +++ b/code/modules/mob/living/simple_animal/friendly/cockroach.dm @@ -21,10 +21,8 @@ loot = list(/obj/effect/decal/cleanable/deadcockroach) del_on_death = 1 -/mob/living/simple_animal/cockroach/death(gibbed) - if(ticker.cinematic) //If the nuke is going off, then cockroaches are invincible. Keeps the nuke from killing them, cause cockroaches are immune to nukes. - return - ..() +/mob/living/simple_animal/cockroach/can_die() + return ..() && !ticker.cinematic //If the nuke is going off, then cockroaches are invincible. Keeps the nuke from killing them, cause cockroaches are immune to nukes. /mob/living/simple_animal/cockroach/Crossed(var/atom/movable/AM) if(isliving(AM)) @@ -48,4 +46,4 @@ icon = 'icons/effects/blood.dmi' icon_state = "xfloor1" random_icon_states = list("xfloor1", "xfloor2", "xfloor3", "xfloor4", "xfloor5", "xfloor6", "xfloor7") - anchored = 1 \ No newline at end of file + anchored = 1 diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index bda169fe576..77d930b6b69 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -41,14 +41,6 @@ . = ..() regenerate_icons() -/mob/living/simple_animal/pet/corgi/death(gibbed) - ..() - regenerate_icons() - -/mob/living/simple_animal/pet/corgi/revive() - ..() - regenerate_icons() - /mob/living/simple_animal/pet/corgi/show_inv(mob/user as mob) user.set_machine(src) if(user.stat) return @@ -626,7 +618,10 @@ s.start() /mob/living/simple_animal/pet/corgi/Ian/borgi/death(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread s.set_up(3, 1, src) s.start() - ..() diff --git a/code/modules/mob/living/simple_animal/friendly/corgi_powers.dm b/code/modules/mob/living/simple_animal/friendly/corgi_powers.dm index 52769f9dba6..5f6f34b8b1c 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi_powers.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi_powers.dm @@ -2,8 +2,5 @@ set name = "Chase your tail" set desc = "d'awwww." set category = "Corgi" - to_chat(src, text("[pick("You dance around","You chase your tail")].")) - for(var/mob/O in oviewers(src, null)) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] [pick("dances around","chases its tail")].", src)) - spin(20, 1) \ No newline at end of file + visible_message("[src] [pick("dances around","chases [p_their()] tail")].","[pick("You dance around","You chase your tail")].") + spin(20, 1) diff --git a/code/modules/mob/living/simple_animal/friendly/crab.dm b/code/modules/mob/living/simple_animal/friendly/crab.dm index 665afa16cb2..6e49437455e 100644 --- a/code/modules/mob/living/simple_animal/friendly/crab.dm +++ b/code/modules/mob/living/simple_animal/friendly/crab.dm @@ -67,22 +67,15 @@ MED.amount -= 1 if(MED.amount <= 0) qdel(MED) - for(var/mob/M in viewers(src, null)) - if((M.client && !( M.blinded ))) - M.show_message("[user] applies the [MED] on [src]") + user.visible_message("[user] applies the [MED] on [src]") else to_chat(user, "this [src] is dead, medical items won't bring it back to life.") else if(O.force) health -= O.force - for(var/mob/M in viewers(src, null)) - if((M.client && !( M.blinded ))) - M.show_message("[src] has been attacked with the [O] by [user]. ") + visible_message("[src] has been attacked with the [O] by [user]. ") else - to_chat(usr, "This weapon is ineffective, it does no damage.") - for(var/mob/M in viewers(src, null)) - if((M.client && !( M.blinded ))) - M.show_message("[user] gently taps [src] with the [O]. ") + user.visible_message("[user] gently taps [src] with the [O]. ","This weapon is ineffective, it does no damage.") /mob/living/simple_animal/crab/Topic(href, href_list) if(usr.stat) return diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 370418134c3..d8a3f793d3a 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -250,7 +250,10 @@ var/global/chicken_count = 0 chicken_count += 1 /mob/living/simple_animal/chicken/death(gibbed) - ..(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return chicken_count -= 1 /mob/living/simple_animal/chicken/attackby(obj/item/O, mob/user, params) diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index 762dea31272..3ed45508b87 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -117,10 +117,13 @@ ..() /mob/living/simple_animal/mouse/death(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE layer = MOB_LAYER if(client) client.time_died_as_mouse = world.time - ..() /* * Mouse types diff --git a/code/modules/mob/living/simple_animal/hostile/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebot.dm index c2284764050..e08e7e11502 100644 --- a/code/modules/mob/living/simple_animal/hostile/hivebot.dm +++ b/code/modules/mob/living/simple_animal/hostile/hivebot.dm @@ -48,10 +48,13 @@ ranged = 1 /mob/living/simple_animal/hostile/hivebot/death(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread s.set_up(3, 1, src) s.start() - ..() /mob/living/simple_animal/hostile/hivebot/tele//this still needs work name = "Beacon" diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index f3e31925228..93182226972 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -289,8 +289,11 @@ //////////////END HOSTILE MOB TARGETTING AND AGGRESSION//////////// /mob/living/simple_animal/hostile/death(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE LoseTarget() - ..(gibbed) /mob/living/simple_animal/hostile/proc/summon_backup(distance) do_alert_animation(src) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index fe80846935d..39215985963 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -95,17 +95,16 @@ Difficulty: Hard visible_message("\"Vitemvw gsqtpixi. Stivexmsrep ijjmgmirgc gsqtvsqmwih.\"")*/ /mob/living/simple_animal/hostile/megafauna/hierophant/death() - if(health > 0 || stat == DEAD) - return - else - stat = DEAD - blinking = TRUE //we do a fancy animation, release a huge burst(), and leave our staff. - animate(src, alpha = 0, color = "660099", time = 20, easing = EASE_OUT) - burst_range = 10 - //visible_message("\"Mrmxmexmrk wipj-hiwxvygx wiuyirgi...\"") - visible_message("[src] disappears in a massive burst of magic, leaving only its staff.") - burst(get_turf(src)) - ..() + if(!can_die()) + return FALSE + blinking = TRUE //we do a fancy animation, release a huge burst(), and leave our staff. + animate(src, alpha = 0, color = "660099", time = 20, easing = EASE_OUT) + burst_range = 10 + //visible_message("\"Mrmxmexmrk wipj-hiwxvygx wiuyirgi...\"") + visible_message("[src] disappears in a massive burst of magic, leaving only its staff.") + burst(get_turf(src)) + // Things are in this order due to `del_on_death` + return ..() /mob/living/simple_animal/hostile/megafauna/hierophant/Destroy() QDEL_NULL(spawned_rune) @@ -612,4 +611,4 @@ Difficulty: Hard icon_state = "hierophant" smooth = SMOOTH_TRUE -#undef MEDAL_PREFIX \ No newline at end of file +#undef MEDAL_PREFIX diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm index 1bfb56bd26f..43be29ada66 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm @@ -89,9 +89,12 @@ Difficulty: Medium speed = 2 charging = 0 +/mob/living/simple_animal/hostile/megafauna/legion/can_die() + return ..() && health <= 0 + /mob/living/simple_animal/hostile/megafauna/legion/death() - if(health > 0) - return + if(!can_die()) + return FALSE if(size > 1) adjustHealth(-maxHealth) //heal ourself to full in prep for splitting var/mob/living/simple_animal/hostile/megafauna/legion/L = new(loc) @@ -117,7 +120,9 @@ Difficulty: Medium L.GiveTarget(target) visible_message("[src] splits in twain!") + return FALSE // not dead else + // this must come before the parent call due to the setting of `loot` here var/last_legion = TRUE for(var/mob/living/simple_animal/hostile/megafauna/legion/other in mob_list) if(other != src) @@ -128,7 +133,7 @@ Difficulty: Medium elimination = 0 else if(prob(5)) loot = list(/obj/structure/closet/crate/necropolis/tendril) - ..() + return ..() /mob/living/simple_animal/hostile/megafauna/legion/Process_Spacemove(movement_dir = 0) return 1 @@ -139,4 +144,4 @@ Difficulty: Medium desc = "The message repeats." invisibility = 100 -#undef MEDAL_PREFIX \ No newline at end of file +#undef MEDAL_PREFIX diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm index 23a25d6df28..74d6513364b 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/megafauna.dm @@ -47,27 +47,16 @@ QDEL_NULL(internal_gps) . = ..() +/mob/living/simple_animal/hostile/megafauna/can_die() + return ..() && health <= 0 + /mob/living/simple_animal/hostile/megafauna/death(gibbed) - if(health > 0) - return - else - if(!admin_spawned) - feedback_set_details("megafauna_kills","[initial(name)]") - if(!elimination) //used so the achievment only occurs for the last legion to die. - grant_achievement(medal_type,score_type) - ..() - -/mob/living/simple_animal/hostile/megafauna/gib() - if(health > 0) - return - else - ..() - -/mob/living/simple_animal/hostile/megafauna/dust() - if(health > 0) - return - else - ..() + // this happens before the parent call because `del_on_death` may be set + if(can_die() && !admin_spawned) + feedback_set_details("megafauna_kills","[initial(name)]") + if(!elimination) //used so the achievment only occurs for the last legion to die. + grant_achievement(medal_type,score_type) + return ..() /mob/living/simple_animal/hostile/megafauna/AttackingTarget() ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 5832f7bdd60..5c26fe1ba57 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -92,11 +92,13 @@ icon_state = initial(icon_state) /mob/living/simple_animal/hostile/mimic/crate/death(gibbed) - var/obj/structure/closet/crate/C = new(get_turf(src)) - // Put loot in crate - for(var/obj/O in src) - O.loc = C - ..() + if(can_die()) + var/obj/structure/closet/crate/C = new(get_turf(src)) + // Put loot in crate + for(var/obj/O in src) + O.loc = C + // due to `del_on_death` + return ..() /mob/living/simple_animal/hostile/mimic/crate/AttackingTarget() . =..() @@ -129,9 +131,11 @@ var/global/list/protected_objects = list(/obj/structure/table, /obj/structure/ca death() /mob/living/simple_animal/hostile/mimic/copy/death(gibbed) - for(var/atom/movable/M in src) - M.loc = get_turf(src) - ..() + if(can_die()) + for(var/atom/movable/M in src) + M.loc = get_turf(src) + // due to `del_on_death` + return ..() /mob/living/simple_animal/hostile/mimic/copy/ListTargets() . = ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm b/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm index 6da4c6e8b68..45bb40ede14 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/hivelord.dm @@ -46,8 +46,11 @@ OpenFire() /mob/living/simple_animal/hostile/asteroid/hivelord/death(gibbed) + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE mouse_opacity = 1 - ..(gibbed) /obj/item/organ/internal/hivelord_core name = "hivelord remains" @@ -165,9 +168,10 @@ color = "#C80000" /mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood/death() - if(loc) // Splash the turf we are on with blood + if(can_die() && loc) + // Splash the turf we are on with blood reagents.reaction(get_turf(src)) - ..() + return ..() /mob/living/simple_animal/hostile/asteroid/hivelordbrood/blood/New() create_reagents(30) @@ -235,15 +239,17 @@ var/mob/living/carbon/human/stored_mob /mob/living/simple_animal/hostile/asteroid/hivelord/legion/death(gibbed) - visible_message("The skulls on [src] wail in anger as they flee from their dying host!") - var/turf/T = get_turf(src) - if(T) - if(stored_mob) - stored_mob.forceMove(get_turf(src)) - stored_mob = null - else - new /obj/effect/mob_spawn/human/corpse/charredskeleton(T) - ..(gibbed) + if(can_die()) + visible_message("The skulls on [src] wail in anger as they flee from their dying host!") + var/turf/T = get_turf(src) + if(T) + if(stored_mob) + stored_mob.forceMove(get_turf(src)) + stored_mob = null + else + new /obj/effect/mob_spawn/human/corpse/charredskeleton(T) + // due to `del_on_death` + return ..(gibbed) /mob/living/simple_animal/hostile/asteroid/hivelordbrood/legion @@ -330,4 +336,4 @@ mob_gender = NEUTER husk = FALSE mob_species = /datum/species/skeleton - mob_color = "#454545" \ No newline at end of file + mob_color = "#454545" diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index 2c775074253..a866e0540b3 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -91,7 +91,10 @@ UpdateMushroomCap() /mob/living/simple_animal/hostile/mushroom/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE UpdateMushroomCap() /mob/living/simple_animal/hostile/mushroom/proc/UpdateMushroomCap() @@ -160,4 +163,4 @@ S.reagents.add_reagent("psilocybin", powerlevel) S.reagents.add_reagent("omnizine", powerlevel) S.reagents.add_reagent("synaptizine", powerlevel) - qdel(src) \ No newline at end of file + qdel(src) diff --git a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm index 30546ecb17d..93e03e8279e 100644 --- a/code/modules/mob/living/simple_animal/hostile/spaceworms.dm +++ b/code/modules/mob/living/simple_animal/hostile/spaceworms.dm @@ -184,7 +184,10 @@ //Harder to kill the head, but it can kill off the whole worm /mob/living/simple_animal/hostile/spaceWorm/wormHead/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE if(prob(catastrophicDeathProb)) for(var/mob/living/simple_animal/hostile/spaceWorm/SW in totalWormSegments) SW.death() @@ -294,7 +297,10 @@ /mob/living/simple_animal/hostile/spaceWorm/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE if(myHead) myHead.totalWormSegments -= src diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/chem.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/chem.dm index 0ed63563011..337988346ce 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/chem.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/chem.dm @@ -9,25 +9,26 @@ metabolization_rate = 0.1 /datum/reagent/terror_black_toxin/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(volume < 30) // bitten once, die very slowly. Easy to survive a single bite - just go to medbay. // total damage: 1/tick, human health 150 until crit, = 150 ticks, = 300 seconds = 5 minutes to get to medbay. - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) else if(volume < 60) // bitten twice, die slowly. Get to medbay. // total damage: 2/tick, human health 150 until crit, = 75 ticks, = 150 seconds = 2.5 minutes to get some medical treatment. - M.adjustToxLoss(2) - M.EyeBlurry(3) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.EyeBlurry(3, FALSE) else if(volume < 90) // bitten thrice, die quickly, severe muscle cramps make movement very difficult. Even calling for help probably won't save you. // total damage: 4, human health 150 until crit, = 37.5 ticks, = 75s = 1m15s until death - M.adjustToxLoss(4) // a bit worse than coiine + update_flags |= M.adjustToxLoss(4, FALSE) // a bit worse than coiine + update_flags |= M.EyeBlurry(6, FALSE) M.Confused(6) - M.EyeBlurry(6) else // bitten 4 or more times, whole body goes into shock/death // total damage: 8, human health 150 until crit, = 18.75 ticks, = 37s until death - M.adjustToxLoss(8) - M.EyeBlurry(6) - M.Paralyse(5) - ..() + update_flags |= M.adjustToxLoss(8, FALSE) + update_flags |= M.EyeBlurry(6, FALSE) + update_flags |= M.Paralyse(5, FALSE) + return ..() | update_flags diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/gray.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/gray.dm index 43c0e7b0be5..59e3bebbfb3 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/gray.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/gray.dm @@ -41,12 +41,12 @@ L.attack_animal(src) /mob/living/simple_animal/hostile/poison/terror_spider/gray/adjustBruteLoss(damage) - ..(damage) + . = ..(damage) if(invisibility > 0) GrayDeCloak() /mob/living/simple_animal/hostile/poison/terror_spider/gray/adjustFireLoss(damage) - ..(damage) + . = ..(damage) if(invisibility > 0) GrayDeCloak() @@ -136,4 +136,4 @@ if(temp_vent) if(get_dist(src,temp_vent) > 0 && get_dist(src,temp_vent) < 5) step_to(src,temp_vent) - // if you're bumped off your vent, try to get back to it \ No newline at end of file + // if you're bumped off your vent, try to get back to it diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/mother.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/mother.dm index f4ab38eda93..9280b428e9e 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/mother.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/mother.dm @@ -33,24 +33,25 @@ ventsmash_action.Grant(src) /mob/living/simple_animal/hostile/poison/terror_spider/mother/death(gibbed) - var/always_stillborn = FALSE - if(spider_awaymission && !is_away_level(z)) - always_stillborn = TRUE - if(canspawn) - canspawn = 0 - for(var/i in 0 to 30) - var/obj/structure/spider/spiderling/terror_spiderling/S = new /obj/structure/spider/spiderling/terror_spiderling(get_turf(src)) - S.grow_as = pick(/mob/living/simple_animal/hostile/poison/terror_spider/red, /mob/living/simple_animal/hostile/poison/terror_spider/gray) - if(always_stillborn || prob(66)) - S.stillborn = 1 - else if(prob(10)) - S.grow_as = pick(/mob/living/simple_animal/hostile/poison/terror_spider/black, /mob/living/simple_animal/hostile/poison/terror_spider/green) - S.amount_grown = 50 // double speed growth - S.immediate_ventcrawl = 1 - visible_message("[src] breaks apart, the many spiders on its back scurrying everywhere!") - degenerate = 1 - ..() + if(can_die()) + var/always_stillborn = FALSE + if(spider_awaymission && !is_away_level(z)) + always_stillborn = TRUE + if(canspawn) + canspawn = 0 + for(var/i in 0 to 30) + var/obj/structure/spider/spiderling/terror_spiderling/S = new /obj/structure/spider/spiderling/terror_spiderling(get_turf(src)) + S.grow_as = pick(/mob/living/simple_animal/hostile/poison/terror_spider/red, /mob/living/simple_animal/hostile/poison/terror_spider/gray) + if(always_stillborn || prob(66)) + S.stillborn = 1 + else if(prob(10)) + S.grow_as = pick(/mob/living/simple_animal/hostile/poison/terror_spider/black, /mob/living/simple_animal/hostile/poison/terror_spider/green) + S.amount_grown = 50 // double speed growth + S.immediate_ventcrawl = 1 + visible_message("[src] breaks apart, the many spiders on its back scurrying everywhere!") + degenerate = 1 + return ..() /mob/living/simple_animal/hostile/poison/terror_spider/mother/Destroy() canspawn = 0 - return ..() \ No newline at end of file + return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/prince.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/prince.dm index 66e88af1e1b..75cf5c7ede8 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/prince.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/prince.dm @@ -36,10 +36,9 @@ thickweb_action.Grant(src) /mob/living/simple_animal/hostile/poison/terror_spider/prince/death(gibbed) - if(!hasdied) - if(spider_uo71) - UnlockBlastDoors("UO71_SciStorage") - ..() + if(can_die() && !hasdied && spider_uo71) + UnlockBlastDoors("UO71_SciStorage") + return ..() /mob/living/simple_animal/hostile/poison/terror_spider/prince/spider_specialattack(mob/living/carbon/human/L) if(prob(15)) @@ -47,4 +46,4 @@ L.Weaken(5) L.Stun(5) else - ..() \ No newline at end of file + ..() diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/purple.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/purple.dm index 5c483b4e3e9..2c3e573c43e 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/purple.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/purple.dm @@ -38,7 +38,7 @@ thickweb_action.Grant(src) /mob/living/simple_animal/hostile/poison/terror_spider/purple/death(gibbed) - if(spider_myqueen) + if(can_die() && spider_myqueen) var/mob/living/simple_animal/hostile/poison/terror_spider/queen/Q = spider_myqueen if(Q.stat != DEAD && !Q.ckey) if(get_dist(src,Q) > 20) @@ -46,7 +46,7 @@ degenerate = 1 Q.DoLayTerrorEggs(/mob/living/simple_animal/hostile/poison/terror_spider/purple,1,0) visible_message("[src] chitters in the direction of [Q]!") - . = ..() + return ..() /mob/living/simple_animal/hostile/poison/terror_spider/purple/Life(seconds, times_fired) . = ..() @@ -91,4 +91,4 @@ degenerate = 1 to_chat(src,"Your link to your Queen has been broken! Your life force starts to drain away!") melee_damage_lower = 5 - melee_damage_upper = 10 \ No newline at end of file + melee_damage_upper = 10 diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm index 532c2b7357a..54531e62d09 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/queen.dm @@ -81,7 +81,7 @@ to_chat(src, "You have [canlay] eggs available to lay.") /mob/living/simple_animal/hostile/poison/terror_spider/queen/death(gibbed) - if(!hasdied) + if(can_die() && !hasdied) SetHiveCommand(0, 15) // Hive becomes very aggressive. if(spider_uo71) UnlockBlastDoors("UO71_Caves") @@ -91,7 +91,7 @@ P.visible_message("\The [src] writhes in pain!") to_chat(P,"\The [src] has died. Without her hivemind link, purple terrors like yourself cannot survive more than a few minutes!") P.degenerate = 1 - ..() + return ..() /mob/living/simple_animal/hostile/poison/terror_spider/queen/Retaliate() ..() @@ -347,4 +347,4 @@ if(L.can_inject(null, 0, "chest", 0)) L.Hallucinate(400) if(!isterrorspider(L)) - L.adjustToxLoss(bonus_tox) \ No newline at end of file + L.adjustToxLoss(bonus_tox) diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_ai.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_ai.dm index 62f69b20b39..8c48b9b409b 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_ai.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_ai.dm @@ -162,11 +162,11 @@ ..() /mob/living/simple_animal/hostile/poison/terror_spider/adjustBruteLoss(damage) - ..(damage) + . = ..(damage) Retaliate() /mob/living/simple_animal/hostile/poison/terror_spider/adjustFireLoss(damage) - ..(damage) + . = ..(damage) Retaliate() /mob/living/simple_animal/hostile/poison/terror_spider/proc/Retaliate() @@ -318,4 +318,4 @@ /mob/living/simple_animal/hostile/poison/terror_spider/proc/UnlockBlastDoors(target_id_tag) for(var/obj/machinery/door/poddoor/P in airlocks) if(P.density && P.id_tag == target_id_tag && P.z == z && !P.operating) - P.open() \ No newline at end of file + P.open() diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm index b5d0a100ae3..46b903774f3 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/terror_spiders.dm @@ -321,10 +321,11 @@ var/global/list/ts_spiderling_list = list() ts_count_alive_station-- /mob/living/simple_animal/hostile/poison/terror_spider/death(gibbed) - if(!gibbed) - msg_terrorspiders("[src] has died in [get_area(src)].") - handle_dying() - ..() + if(can_die()) + if(!gibbed) + msg_terrorspiders("[src] has died in [get_area(src)].") + handle_dying() + return ..() /mob/living/simple_animal/hostile/poison/terror_spider/proc/spider_special_action() return @@ -372,4 +373,4 @@ var/global/list/ts_spiderling_list = list() visible_message("[src] pries open the door!") playsound(src.loc, "sparks", 100, 1) D.open(1) - return 1 \ No newline at end of file + return 1 diff --git a/code/modules/mob/living/simple_animal/hostile/terror_spiders/white.dm b/code/modules/mob/living/simple_animal/hostile/terror_spiders/white.dm index 973195c90a7..36378cb988e 100644 --- a/code/modules/mob/living/simple_animal/hostile/terror_spiders/white.dm +++ b/code/modules/mob/living/simple_animal/hostile/terror_spiders/white.dm @@ -31,10 +31,9 @@ ..() /mob/living/simple_animal/hostile/poison/terror_spider/white/death(gibbed) - if(!hasdied) - if(spider_uo71) - UnlockBlastDoors("UO71_Bridge") - ..() + if(can_die() && !hasdied && spider_uo71) + UnlockBlastDoors("UO71_Bridge") + return ..(gibbed) /mob/living/simple_animal/hostile/poison/terror_spider/white/spider_specialattack(mob/living/carbon/human/L, poisonable) if(!poisonable) @@ -57,4 +56,4 @@ /proc/IsTSInfected(mob/living/carbon/C) // Terror AI requires this if(C.get_int_organ(/obj/item/organ/internal/body_egg)) return 1 - return 0 \ No newline at end of file + return 0 diff --git a/code/modules/mob/living/simple_animal/hostile/winter_mobs.dm b/code/modules/mob/living/simple_animal/hostile/winter_mobs.dm index 70ea0400f84..f96ebabf014 100644 --- a/code/modules/mob/living/simple_animal/hostile/winter_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/winter_mobs.dm @@ -36,15 +36,14 @@ /mob/living/simple_animal/hostile/winter/snowman/death(gibbed) - if(prob(50) && !ranged) //50% chance to drop candy cane sword on death, if it has one to drop - loot = list(/obj/item/melee/candy_sword) - if(prob(20)) //chance to become a stationary snowman structure instead of a corpse - loot.Add(/obj/structure/snowman) - deathmessage = "shimmers as its animating magic fades away!" - del_on_death = 1 - ..() //this is just to make sure it gets properly killed before we qdel it - else - ..() + if(can_die()) + if(prob(50) && !ranged) //50% chance to drop candy cane sword on death, if it has one to drop + loot = list(/obj/item/melee/candy_sword) + if(prob(20)) //chance to become a stationary snowman structure instead of a corpse + loot.Add(/obj/structure/snowman) + deathmessage = "shimmers as its animating magic fades away!" + del_on_death = 1 + return ..() /mob/living/simple_animal/hostile/winter/snowman/ranged maxHealth = 50 @@ -79,7 +78,10 @@ icon_dead = "santa-dead" /mob/living/simple_animal/hostile/winter/santa/death(gibbed) - ..() + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE if(death_message) visible_message(death_message) if(next_stage) @@ -133,12 +135,16 @@ melee_damage_upper = 30 //that's gonna leave a mark, for sure /mob/living/simple_animal/hostile/winter/santa/stage_4/death(gibbed) - to_chat(world, "
") - to_chat(world, "THE FAT MAN HAS FALLEN!") - to_chat(world, "SANTA CLAUS HAS BEEN DEFEATED!") - to_chat(world, "
") - ..() + if(can_die()) + to_chat(world, "
") + to_chat(world, "THE FAT MAN HAS FALLEN!") + to_chat(world, "SANTA CLAUS HAS BEEN DEFEATED!") + to_chat(world, "
") + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE var/obj/item/grenade/clusterbuster/xmas/X = new /obj/item/grenade/clusterbuster/xmas(get_turf(src)) var/obj/item/grenade/clusterbuster/xmas/Y = new /obj/item/grenade/clusterbuster/xmas(get_turf(src)) X.prime() - Y.prime() \ No newline at end of file + Y.prime() diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index ed4c074bff0..2120925a164 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -113,11 +113,12 @@ return ..() /mob/living/simple_animal/parrot/death(gibbed) - if(held_item) - held_item.loc = src.loc - held_item = null - walk(src,0) - ..() + if(can_die()) + if(held_item) + held_item.loc = src.loc + held_item = null + walk(src,0) + return ..() /mob/living/simple_animal/parrot/Stat() ..() diff --git a/code/modules/mob/living/simple_animal/posessed_object.dm b/code/modules/mob/living/simple_animal/posessed_object.dm index 22901f4d29a..6fa2e65e207 100644 --- a/code/modules/mob/living/simple_animal/posessed_object.dm +++ b/code/modules/mob/living/simple_animal/posessed_object.dm @@ -15,6 +15,7 @@ allow_spin = 0 // No spinning. Spinning breaks our floating animation. no_spin_thrown = 1 + del_on_death = TRUE var/obj/item/possessed_item @@ -44,21 +45,14 @@ ghost.timeofdeath = world.time death(0) // Turn back into a regular object. - /mob/living/simple_animal/possessed_object/death(gibbed) - var/mob/dead/observer/ghost = ghostize(1) - ..() - - if(gibbed) // Leave no trace. - ghost.timeofdeath = world.time - qdel(src) - return - - if(possessed_item.loc == src) - possessed_item.forceMove(loc) // Put the normal item back once the EVIL SPIRIT has been vanquished from it. If it's not already in place - - qdel(src) - + if(can_die()) + ghostize(GHOST_CAN_REENTER) + // if gibbed, the item goes with the ghost + if(!gibbed && possessed_item.loc == src) + // Put the normal item back once the EVIL SPIRIT has been vanquished from it. If it's not already in place + possessed_item.forceMove(loc) + return ..() /mob/living/simple_animal/possessed_object/Life(seconds, times_fired) ..() @@ -160,4 +154,4 @@ pixel_y = possessed_item.pixel_y color = possessed_item.color overlays = possessed_item.overlays - set_opacity(possessed_item.opacity) \ No newline at end of file + set_opacity(possessed_item.opacity) diff --git a/code/modules/mob/living/simple_animal/powers.dm b/code/modules/mob/living/simple_animal/powers.dm index 9d1d6217415..d85557f350d 100644 --- a/code/modules/mob/living/simple_animal/powers.dm +++ b/code/modules/mob/living/simple_animal/powers.dm @@ -8,13 +8,7 @@ if(layer != TURF_LAYER+0.2) layer = TURF_LAYER+0.2 - to_chat(src, text("You are now hiding.")) - for(var/mob/O in oviewers(src, null)) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] scurries to the ground!", src)) + visible_message("[src] scurries to the ground!", "You are now hiding.") else layer = MOB_LAYER - to_chat(src, text("You have stopped hiding.")) - for(var/mob/O in oviewers(src, null)) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] slowly peaks up from the ground...", src)) + visible_message("[src] slowly peeks up from the ground...", "You have stopped hiding.") diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 2f761c21f9c..47113341881 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -29,25 +29,20 @@ deathmessage = "lets out a contented sigh as their form unwinds." - attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri - if(istype(O, /obj/item/soulstone)) - O.transfer_soul("SHADE", src, user) +/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri + if(istype(O, /obj/item/soulstone)) + O.transfer_soul("SHADE", src, user) + else + if(O.force) + var/damage = O.force + if(O.damtype == STAMINA) + damage = 0 + health -= damage + user.visible_message("[src] has been attacked with the [O] by [user]. ") else - if(O.force) - var/damage = O.force - if(O.damtype == STAMINA) - damage = 0 - health -= damage - for(var/mob/M in viewers(src, null)) - if((M.client && !( M.blinded ))) - M.show_message("[src] has been attacked with the [O] by [user]. ") - else - to_chat(usr, "This weapon is ineffective, it does no damage.") - for(var/mob/M in viewers(src, null)) - if((M.client && !( M.blinded ))) - M.show_message("[user] gently taps [src] with the [O]. ") - return + user.visible_message("[user] gently taps [src] with the [O]. ", "This weapon is ineffective, it does no damage.") + return /mob/living/simple_animal/shade/sword universal_speak = 1 - faction = list("neutral") \ No newline at end of file + faction = list("neutral") diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 5a88373f6f2..0015327bca7 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -105,8 +105,8 @@ client.screen += client.void ..() -/mob/living/simple_animal/updatehealth() - ..() +/mob/living/simple_animal/updatehealth(reason = "none given") + ..(reason) health = Clamp(health, 0, maxHealth) med_hud_set_status() @@ -127,12 +127,15 @@ else if(stat != DEAD) icon_state = icon_living -/mob/living/simple_animal/handle_regular_status_updates() - if(..()) //alive +/mob/living/simple_animal/update_stat(reason = "none given") + if(status_flags & GODMODE) + return + + ..(reason) + if(stat != DEAD) if(health < 1) death() - return FALSE - return TRUE + create_debug_log("died of damage, trigger reason: [reason]") /mob/living/simple_animal/proc/handle_automated_action() return @@ -303,6 +306,10 @@ stat(null, "Health: [round((health / maxHealth) * 100)]%") /mob/living/simple_animal/death(gibbed) + // Only execute the below if we successfully died + . = ..() + if(!.) + return FALSE if(nest) nest.spawned_mobs -= src nest = null @@ -322,10 +329,8 @@ else health = 0 icon_state = icon_dead - stat = DEAD density = 0 lying = 1 - ..() /mob/living/simple_animal/ex_act(severity) ..() @@ -341,35 +346,42 @@ if(3.0) adjustBruteLoss(30) -/mob/living/simple_animal/proc/adjustHealth(amount) +/mob/living/simple_animal/proc/adjustHealth(amount, updating_health = TRUE) if(status_flags & GODMODE) return FALSE + var/oldbruteloss = bruteloss bruteloss = Clamp(bruteloss + amount, 0, maxHealth) - handle_regular_status_updates() + if(oldbruteloss == bruteloss) + updating_health = FALSE + . = STATUS_UPDATE_NONE + else + . = STATUS_UPDATE_HEALTH + if(updating_health) + updatehealth() -/mob/living/simple_animal/adjustBruteLoss(amount) +/mob/living/simple_animal/adjustBruteLoss(amount, updating_health = TRUE) if(damage_coeff[BRUTE]) - adjustHealth(amount * damage_coeff[BRUTE]) + return adjustHealth(amount * damage_coeff[BRUTE], updating_health) -/mob/living/simple_animal/adjustFireLoss(amount) +/mob/living/simple_animal/adjustFireLoss(amount, updating_health = TRUE) if(damage_coeff[BURN]) - adjustHealth(amount * damage_coeff[BURN]) + return adjustHealth(amount * damage_coeff[BURN], updating_health) -/mob/living/simple_animal/adjustOxyLoss(amount) +/mob/living/simple_animal/adjustOxyLoss(amount, updating_health = TRUE) if(damage_coeff[OXY]) - adjustHealth(amount * damage_coeff[OXY]) + return adjustHealth(amount * damage_coeff[OXY], updating_health) -/mob/living/simple_animal/adjustToxLoss(amount) +/mob/living/simple_animal/adjustToxLoss(amount, updating_health = TRUE) if(damage_coeff[TOX]) - adjustHealth(amount * damage_coeff[TOX]) + return adjustHealth(amount * damage_coeff[TOX], updating_health) -/mob/living/simple_animal/adjustCloneLoss(amount) +/mob/living/simple_animal/adjustCloneLoss(amount, updating_health = TRUE) if(damage_coeff[CLONE]) - adjustHealth(amount * damage_coeff[CLONE]) + return adjustHealth(amount * damage_coeff[CLONE], updating_health) -/mob/living/simple_animal/adjustStaminaLoss(amount) +/mob/living/simple_animal/adjustStaminaLoss(amount, updating_health = TRUE) if(damage_coeff[STAMINA]) - return ..(amount*damage_coeff[STAMINA]) + return ..(amount*damage_coeff[STAMINA], updating_health) /mob/living/simple_animal/proc/CanAttack(var/atom/the_target) if(see_invisible < the_target.invisibility) diff --git a/code/modules/mob/living/simple_animal/tribbles.dm b/code/modules/mob/living/simple_animal/tribbles.dm index 3e7f1722a41..0f10a9ad382 100644 --- a/code/modules/mob/living/simple_animal/tribbles.dm +++ b/code/modules/mob/living/simple_animal/tribbles.dm @@ -80,7 +80,10 @@ var/global/totaltribbles = 0 //global variable so it updates for all tribbles, /mob/living/simple_animal/tribble/death(gibbed) // Gotta make sure to remove tribbles from the list on death - ..() + // Only execute the below if we successfully died + . = ..(gibbed) + if(!.) + return FALSE totaltribbles -= 1 @@ -195,10 +198,7 @@ var/global/totaltribbles = 0 //global variable so it updates for all tribbles, if(src.destroyed) return else - to_chat(usr, text("You kick the lab cage.")) - for(var/mob/O in oviewers()) - if((O.client && !( O.blinded ))) - to_chat(O, text("[] kicks the lab cage.", usr)) + user.visible_message("[user] kicks the lab cage.", "You kick the lab cage.") src.health -= 2 healthcheck() return diff --git a/code/modules/mob/living/stat_states.dm b/code/modules/mob/living/stat_states.dm index 3decff7596e..c9c51e2c5ab 100644 --- a/code/modules/mob/living/stat_states.dm +++ b/code/modules/mob/living/stat_states.dm @@ -10,7 +10,8 @@ log_game("[key_name(src)] fell unconscious at [atom_loc_line(get_turf(src))]") stat = UNCONSCIOUS if(updating) - // update_blind_effects() + update_sight() + update_blind_effects() update_canmove() return 1 @@ -24,7 +25,8 @@ log_game("[key_name(src)] woke up at [atom_loc_line(get_turf(src))]") stat = CONSCIOUS if(updating) - // update_blind_effects() + update_sight() + update_blind_effects() update_canmove() return 1 @@ -47,11 +49,14 @@ stat = CONSCIOUS dead_mob_list -= src living_mob_list += src + if(mind) + respawnable_list -= src timeofdeath = null if(updating) update_canmove() - // update_blind_effects() - updatehealth() + update_blind_effects() + update_sight() + updatehealth("update revive") for(var/s in ownedSoullinks) var/datum/soullink/S = s diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index 972a8b0d553..8fdeec94679 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -216,19 +216,22 @@ // DRUGGY -/mob/living/Druggy(amount) - SetDruggy(max(druggy, amount)) +/mob/living/Druggy(amount, updating = TRUE) + return SetDruggy(max(druggy, amount), updating) -/mob/living/SetDruggy(amount) - var/old_val = druggy +/mob/living/SetDruggy(amount, updating = TRUE) + . = STATUS_UPDATE_DRUGGY + if((!!amount) == (!!druggy)) // We're not changing from + to 0 or vice versa + . = STATUS_UPDATE_NONE + updating = FALSE druggy = max(amount, 0) // We transitioned to/from 0, so update the druggy overlays - if((old_val == 0 || druggy == 0) && (old_val != druggy)) + if(updating) update_druggy_effects() -/mob/living/AdjustDruggy(amount, bound_lower = 0, bound_upper = INFINITY) +/mob/living/AdjustDruggy(amount, bound_lower = 0, bound_upper = INFINITY, updating = TRUE) var/new_value = directional_bounded_sum(druggy, amount, bound_lower, bound_upper) - SetDruggy(new_value) + return SetDruggy(new_value, updating) // EAR_DAMAGE @@ -256,35 +259,41 @@ // EYE_BLIND -/mob/living/EyeBlind(amount) - SetEyeBlind(max(eye_blind, amount)) +/mob/living/EyeBlind(amount, updating = TRUE) + return SetEyeBlind(max(eye_blind, amount), updating) -/mob/living/SetEyeBlind(amount) - var/old_val = eye_blind +/mob/living/SetEyeBlind(amount, updating = TRUE) + . = STATUS_UPDATE_BLIND + if((!!amount) == (!!eye_blind)) // We're not changing from + to 0 or vice versa + updating = FALSE + . = STATUS_UPDATE_NONE eye_blind = max(amount, 0) // We transitioned to/from 0, so update the eye blind overlays - if((old_val == 0 || eye_blind == 0) && (old_val != eye_blind)) + if(updating) update_blind_effects() -/mob/living/AdjustEyeBlind(amount, bound_lower = 0, bound_upper = INFINITY) +/mob/living/AdjustEyeBlind(amount, bound_lower = 0, bound_upper = INFINITY, updating = TRUE) var/new_value = directional_bounded_sum(eye_blind, amount, bound_lower, bound_upper) - SetEyeBlind(new_value) + return SetEyeBlind(new_value, updating) // EYE_BLURRY -/mob/living/EyeBlurry(amount) - SetEyeBlurry(max(eye_blurry, amount)) +/mob/living/EyeBlurry(amount, updating = TRUE) + return SetEyeBlurry(max(eye_blurry, amount), updating) -/mob/living/SetEyeBlurry(amount) - var/old_val = eye_blurry +/mob/living/SetEyeBlurry(amount, updating = TRUE) + . = STATUS_UPDATE_BLURRY + if((!!amount) == (!!eye_blurry)) // We're not changing from + to 0 or vice versa + updating = FALSE + . = STATUS_UPDATE_NONE eye_blurry = max(amount, 0) // We transitioned to/from 0, so update the eye blur overlays - if((old_val == 0 || eye_blurry == 0) && (old_val != eye_blurry)) + if(updating) update_blurry_effects() -/mob/living/AdjustEyeBlurry(amount, bound_lower = 0, bound_upper = INFINITY) +/mob/living/AdjustEyeBlurry(amount, bound_lower = 0, bound_upper = INFINITY, updating = TRUE) var/new_value = directional_bounded_sum(eye_blurry, amount, bound_lower, bound_upper) - SetEyeBlurry(new_value) + return SetEyeBlurry(new_value, updating) // HALLUCINATION @@ -327,20 +336,22 @@ // PARALYSE /mob/living/Paralyse(amount, updating = 1, force = 0) - SetParalysis(max(paralysis, amount), updating, force) + return SetParalysis(max(paralysis, amount), updating, force) /mob/living/SetParalysis(amount, updating = 1, force = 0) + . = STATUS_UPDATE_STAT if((!!amount) == (!!paralysis)) // We're not changing from + to 0 or vice versa updating = FALSE + . = STATUS_UPDATE_NONE if(status_flags & CANPARALYSE || force) paralysis = max(amount, 0) if(updating) update_canmove() - update_stat() + update_stat("paralysis") /mob/living/AdjustParalysis(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1, force = 0) var/new_value = directional_bounded_sum(paralysis, amount, bound_lower, bound_upper) - SetParalysis(new_value, updating, force) + return SetParalysis(new_value, updating, force) // SILENT @@ -357,20 +368,22 @@ // SLEEPING /mob/living/Sleeping(amount, updating = 1, no_alert = FALSE) - SetSleeping(max(sleeping, amount), updating, no_alert) + return SetSleeping(max(sleeping, amount), updating, no_alert) /mob/living/SetSleeping(amount, updating = 1, no_alert = FALSE) + . = STATUS_UPDATE_STAT if((!!amount) == (!!sleeping)) // We're not changing from + to 0 or vice versa updating = FALSE + . = STATUS_UPDATE_NONE sleeping = max(amount, 0) if(updating) update_sleeping_effects(no_alert) - update_stat() + update_stat("sleeping") update_canmove() /mob/living/AdjustSleeping(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1, no_alert = FALSE) var/new_value = directional_bounded_sum(sleeping, amount, bound_lower, bound_upper) - SetSleeping(new_value, updating, no_alert) + return SetSleeping(new_value, updating, no_alert) // SLOWED @@ -411,19 +424,24 @@ // STUN /mob/living/Stun(amount, updating = 1, force = 0) - SetStunned(max(stunned, amount), updating, force) + return SetStunned(max(stunned, amount), updating, force) /mob/living/SetStunned(amount, updating = 1, force = 0) //if you REALLY need to set stun to a set amount without the whole "can't go below current stunned" + . = STATUS_UPDATE_CANMOVE if((!!amount) == (!!stunned)) // We're not changing from + to 0 or vice versa updating = FALSE + . = STATUS_UPDATE_NONE + if(status_flags & CANSTUN || force) stunned = max(amount, 0) if(updating) update_canmove() + else + return STATUS_UPDATE_NONE /mob/living/AdjustStunned(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1, force = 0) var/new_value = directional_bounded_sum(stunned, amount, bound_lower, bound_upper) - SetStunned(new_value, updating, force) + return SetStunned(new_value, updating, force) // STUTTERING @@ -443,19 +461,23 @@ // WEAKEN /mob/living/Weaken(amount, updating = 1, force = 0) - SetWeakened(max(weakened, amount), updating, force) + return SetWeakened(max(weakened, amount), updating, force) /mob/living/SetWeakened(amount, updating = 1, force = 0) + . = STATUS_UPDATE_CANMOVE if((!!amount) == (!!weakened)) // We're not changing from + to 0 or vice versa updating = FALSE + . = STATUS_UPDATE_NONE if(status_flags & CANWEAKEN || force) weakened = max(amount, 0) if(updating) update_canmove() //updates lying, canmove and icons + else + return STATUS_UPDATE_NONE /mob/living/AdjustWeakened(amount, bound_lower = 0, bound_upper = INFINITY, updating = 1, force = 0) var/new_value = directional_bounded_sum(weakened, amount, bound_lower, bound_upper) - SetWeakened(new_value, updating, force) + return SetWeakened(new_value, updating, force) // // DISABILITIES @@ -463,18 +485,19 @@ // Blind -/mob/living/proc/BecomeBlind() +/mob/living/proc/BecomeBlind(updating = TRUE) var/val_change = !(disabilities & BLIND) + . = val_change ? STATUS_UPDATE_BLIND : STATUS_UPDATE_NONE disabilities |= BLIND - if(val_change) + if(val_change && updating) update_blind_effects() -/mob/living/proc/CureBlind() +/mob/living/proc/CureBlind(updating = TRUE) var/val_change = !!(disabilities & BLIND) + . = val_change ? STATUS_UPDATE_BLIND : STATUS_UPDATE_NONE disabilities &= ~BLIND - CureIfHasDisability(BLINDBLOCK) - - if(val_change) + if(val_change && updating) + CureIfHasDisability(BLINDBLOCK) update_blind_effects() // Coughing @@ -515,17 +538,19 @@ // Nearsighted -/mob/living/proc/BecomeNearsighted() +/mob/living/proc/BecomeNearsighted(updating = TRUE) var/val_change = !(disabilities & NEARSIGHTED) + . = val_change ? STATUS_UPDATE_NEARSIGHTED : STATUS_UPDATE_NONE disabilities |= NEARSIGHTED - if(val_change) + if(val_change && updating) update_nearsighted_effects() -/mob/living/proc/CureNearsighted() +/mob/living/proc/CureNearsighted(updating = TRUE) var/val_change = !!(disabilities & NEARSIGHTED) + . = val_change ? STATUS_UPDATE_NEARSIGHTED : STATUS_UPDATE_NONE disabilities &= ~NEARSIGHTED - CureIfHasDisability(GLASSESBLOCK) - if(val_change) + if(val_change && updating) + CureIfHasDisability(GLASSESBLOCK) update_nearsighted_effects() // Nervous diff --git a/code/modules/mob/living/update_status.dm b/code/modules/mob/living/update_status.dm index c7f9bdd0d96..40d4cdc9cb2 100644 --- a/code/modules/mob/living/update_status.dm +++ b/code/modules/mob/living/update_status.dm @@ -1,5 +1,5 @@ /mob/living/update_blind_effects() - if(!has_vision()) + if(!has_vision(information_only=TRUE)) overlay_fullscreen("blind", /obj/screen/fullscreen/blind) throw_alert("blind", /obj/screen/alert/blind) return 1 @@ -44,8 +44,10 @@ return !(ear_deaf || (disabilities & DEAF)) // Whether the mob is able to see -/mob/living/has_vision() - return !(eye_blind || (disabilities & BLIND) || stat) +// `information_only` is for stuff that's purely informational - like understanding nonverbal languages, or blindness overlays +// This flag exists because certain things like angel statues expect this to be false for dead people +/mob/living/has_vision(information_only = FALSE) + return (information_only && stat == DEAD) || !(eye_blind || (disabilities & BLIND) || stat) // Whether the mob is capable of talking /mob/living/can_speak() @@ -104,6 +106,22 @@ /mob/living/proc/update_stamina() return +/mob/living/update_stat(reason = "None given") + if(status_flags & GODMODE) + return + if(stat != DEAD) + if(health <= config.health_threshold_dead) + death() + create_debug_log("died of damage, trigger reason: [reason]") + else if(paralysis || status_flags & FAKEDEATH) + if(stat == CONSCIOUS) + KnockOut() + create_debug_log("fell unconscious, trigger reason: [reason]") + else + if(stat == UNCONSCIOUS) + WakeUp() + create_debug_log("woke up, trigger reason: [reason]") + /mob/living/vv_edit_var(var_name, var_value) . = ..() switch(var_name) @@ -126,6 +144,6 @@ if("druggy") SetDruggy(druggy) if("maxHealth") - updatehealth() + updatehealth("var edit") if("resize") - update_transform() \ No newline at end of file + update_transform() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index c4f10d71452..4560e935547 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -75,7 +75,7 @@ if(!client) return if(type) - if(type & 1 && !has_vision())//Vision related + if(type & 1 && !has_vision(information_only=TRUE))//Vision related if(!( alt )) return else @@ -87,7 +87,7 @@ else msg = alt type = alt_type - if(type & 1 && !has_vision()) + if(type & 1 && !has_vision(information_only=TRUE)) return // Added voice muffling for Issue 41. if(stat == UNCONSCIOUS || (sleeping > 0 && stat != DEAD)) @@ -576,7 +576,7 @@ var/list/slot_equipment_priority = list( \ set name = "Examine" set category = "IC" - if((is_blind(src) || usr.stat) && !isobserver(src)) + if(!has_vision(information_only = TRUE) && !isobserver(src)) to_chat(src, "Something is there but you can't see it.") return 1 @@ -1246,13 +1246,22 @@ var/list/slot_equipment_priority = list( \ return 1 return 0 -/mob/proc/create_attack_log(var/text, var/collapse = 1)//forgive me code gods for this shitcode proc +/mob/proc/create_attack_log(text, collapse = TRUE) + LAZYINITLIST(attack_log) + create_log_in_list(attack_log, text, collapse, last_log) + last_log = world.timeofday + +/mob/proc/create_debug_log(text, collapse = TRUE) + LAZYINITLIST(debug_log) + create_log_in_list(debug_log, text, collapse, world.timeofday) + +/proc/create_log_in_list(list/target, text, collapse = TRUE, last_log)//forgive me code gods for this shitcode proc //this proc enables lovely stuff like an attack log that looks like this: "[18:20:29-18:20:45]21x John Smith attacked Andrew Jackson with a crowbar." //That makes the logs easier to read, but because all of this is stored in strings, weird things have to be used to get it all out. var/new_log = "\[[time_stamp()]] [text]" - if(length(attack_log) > 0)//if there are other logs already present - var/previous_log = attack_log[length(attack_log)]//get the latest log + if(target.len)//if there are other logs already present + var/previous_log = target[target.len]//get the latest log var/last_log_is_range = (copytext(previous_log, 10, 11) == "-") //whether the last log is a time range or not. The "-" will be an indicator that it is. var/x_sign_position = findtext(previous_log, "x") @@ -1277,10 +1286,9 @@ var/list/slot_equipment_priority = list( \ rep = text2num(copytext(previous_log, 44, x_sign_position))//get whatever number is right before the 'x' new_log = "\[[old_timestamp]-[time_stamp()]][rep?rep+1:2]x [text]" - attack_log -= attack_log[length(attack_log)]//remove the last log + target -= target[target.len]//remove the last log - attack_log += new_log - last_log = world.timeofday + target += new_log /mob/vv_get_dropdown() . = ..() diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 57b5aeb4996..bfe9ac7484a 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -29,7 +29,8 @@ var/computer_id = null var/lastattacker = null var/lastattacked = null - var/attack_log = list( ) + var/list/attack_log = list( ) + var/list/debug_log = null var/last_log = 0 var/obj/machinery/machine = null var/other_mobs = null @@ -44,7 +45,6 @@ var/med_record = "" var/sec_record = "" var/gen_record = "" - var/blinded = null var/bhunger = 0 //Carbon var/lying = 0 var/lying_prev = 0 @@ -199,4 +199,4 @@ var/list/tkgrabbed_objects = list() // Assoc list of items to TK grabs - var/forced_look = null // This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing. \ No newline at end of file + var/forced_look = null // This can either be a numerical direction or a soft object reference (UID). It makes the mob always face towards the selected thing. diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 01bcb2bcc1a..c0862b31404 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -397,13 +397,6 @@ var/list/intents = list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM) to_chat(src, "You are now getting up.") StopResting() -/proc/is_blind(A) - if(iscarbon(A)) - var/mob/living/carbon/C = A - if(C.disabilities & BLIND || C.blinded) - return 1 - return 0 - /proc/get_multitool(mob/user as mob) // Get tool var/obj/item/multitool/P @@ -498,7 +491,7 @@ var/list/intents = list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM) A.overlays += alert_overlay /mob/proc/switch_to_camera(var/obj/machinery/camera/C) - if(!C.can_use() || stat || (get_dist(C, src) > 1 || machine != src || blinded || !canmove)) + if(!C.can_use() || stat || (get_dist(C, src) > 1 || machine != src || !has_vision() || !canmove)) return 0 check_eye(src) return 1 diff --git a/code/modules/mob/update_status.dm b/code/modules/mob/update_status.dm index 7e1df6171e7..52a6fb7769d 100644 --- a/code/modules/mob/update_status.dm +++ b/code/modules/mob/update_status.dm @@ -37,7 +37,7 @@ /mob/proc/can_hear() return 1 -/mob/proc/has_vision() +/mob/proc/has_vision(information_only = FALSE) return 1 /mob/proc/can_speak() diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index 73a591f9ddb..c444409eecb 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -196,6 +196,9 @@ var/const/INGEST = 2 if(M) chem_temp = M.bodytemperature handle_reactions() + + // a bitfield filled in by each reagent's `on_mob_life` to find out which states to update + var/update_flags = STATUS_UPDATE_NONE for(var/A in reagent_list) var/datum/reagent/R = A if(!istype(R)) // How are non-reagents ending up in the reagents_list? @@ -233,14 +236,18 @@ var/const/INGEST = 2 continue //If you got this far, that means we can process whatever reagent this iteration is for. Handle things normally from here. if(M && R) - R.on_mob_life(M) + update_flags |= R.on_mob_life(M) if(R.volume >= R.overdose_threshold && !R.overdosed && R.overdose_threshold > 0) R.overdosed = TRUE R.overdose_start(M) if(R.volume < R.overdose_threshold && R.overdosed) R.overdosed = FALSE if(R.overdosed) - R.overdose_process(M, R.volume >= R.overdose_threshold*2 ? 2 : 1) + var/list/overdose_results = R.overdose_process(M, R.volume >= R.overdose_threshold*2 ? 2 : 1) + if(overdose_results) // to protect against poorly-coded overdose procs + update_flags |= overdose_results[REAGENT_OVERDOSE_FLAGS] + else + log_runtime(EXCEPTION("Reagent '[R.name]' does not return an overdose info list!")) for(var/A in addiction_list) var/datum/reagent/R = A @@ -250,18 +257,36 @@ var/const/INGEST = 2 R.addiction_stage++ switch(R.addiction_stage) if(1) - R.addiction_act_stage1(M) + update_flags |= R.addiction_act_stage1(M) if(2) - R.addiction_act_stage2(M) + update_flags |= R.addiction_act_stage2(M) if(3) - R.addiction_act_stage3(M) + update_flags |= R.addiction_act_stage3(M) if(4) - R.addiction_act_stage4(M) + update_flags |= R.addiction_act_stage4(M) if(5) - R.addiction_act_stage5(M) + update_flags |= R.addiction_act_stage5(M) if(prob(20) && (world.timeofday > (R.last_addiction_dose + ADDICTION_TIME))) //Each addiction lasts 8 minutes before it can end to_chat(M, "You no longer feel reliant on [R.name]!") addiction_list.Remove(R) + if(update_flags & STATUS_UPDATE_HEALTH) + M.updatehealth("reagent metabolism") + else if(update_flags & STATUS_UPDATE_STAT) + // update_stat is called in updatehealth + M.update_stat("reagent metabolism") + if(update_flags & STATUS_UPDATE_CANMOVE) + M.update_canmove() + if(update_flags & STATUS_UPDATE_STAMINA) + M.handle_hud_icons_health() + M.update_stamina() + if(update_flags & STATUS_UPDATE_BLIND) + M.update_blind_effects() + if(update_flags & STATUS_UPDATE_BLURRY) + M.update_blurry_effects() + if(update_flags & STATUS_UPDATE_NEARSIGHTED) + M.update_nearsighted_effects() + if(update_flags & STATUS_UPDATE_DRUGGY) + M.update_druggy_effects() update_total() /datum/reagents/proc/death_metabolize(mob/living/M) @@ -716,4 +741,4 @@ atom/proc/create_reagents(max_vol) QDEL_LIST(reagent_list) reagent_list = null if(my_atom && my_atom.reagents == src) - my_atom.reagents = null \ No newline at end of file + my_atom.reagents = null diff --git a/code/modules/reagents/chemistry/reagents.dm b/code/modules/reagents/chemistry/reagents.dm index 16e4197f72c..2ae74f4a91f 100644 --- a/code/modules/reagents/chemistry/reagents.dm +++ b/code/modules/reagents/chemistry/reagents.dm @@ -69,6 +69,7 @@ /datum/reagent/proc/on_mob_life(mob/living/M) current_cycle++ holder.remove_reagent(id, metabolization_rate * M.metabolism_efficiency * M.digestion_ratio) //By default it slowly disappears. + return STATUS_UPDATE_NONE /datum/reagent/proc/on_mob_death(mob/living/M) //use this to have chems have a "death-triggered" effect return @@ -102,15 +103,16 @@ // Called if the reagent has passed the overdose threshold and is set to be triggering overdose effects /datum/reagent/proc/overdose_process(mob/living/M, severity) var/effect = rand(1, 100) - severity + var/update_flags = STATUS_UPDATE_NONE if(effect <= 8) - M.adjustToxLoss(severity) - return effect + update_flags |= (M.adjustToxLoss(severity, FALSE) ? STATUS_UPDATE_HEALTH : STATUS_UPDATE_NONE) + return list(effect, update_flags) /datum/reagent/proc/overdose_start(mob/living/M) return /datum/reagent/proc/addiction_act_stage1(mob/living/M) - return + return STATUS_UPDATE_NONE /datum/reagent/proc/addiction_act_stage2(mob/living/M) if(prob(8)) @@ -119,6 +121,7 @@ M.emote("sneeze") if(prob(4)) to_chat(M, "You feel a dull headache.") + return STATUS_UPDATE_NONE /datum/reagent/proc/addiction_act_stage3(mob/living/M) if(prob(8)) @@ -127,6 +130,7 @@ M.emote("shiver") if(prob(4)) to_chat(M, "You begin craving [name]!") + return STATUS_UPDATE_NONE /datum/reagent/proc/addiction_act_stage4(mob/living/M) if(prob(8)) @@ -135,16 +139,19 @@ to_chat(M, "You have the strong urge for some [name]!") if(prob(4)) to_chat(M, "You REALLY crave some [name]!") + return STATUS_UPDATE_NONE /datum/reagent/proc/addiction_act_stage5(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(8)) M.emote("twitch") if(prob(6)) to_chat(M, "Your stomach lurches painfully!") M.visible_message("[M] gags and retches!") - M.Stun(rand(2,4)) - M.Weaken(rand(2,4)) + update_flags |= M.Stun(rand(2,4), FALSE) + update_flags |= M.Weaken(rand(2,4), FALSE) if(prob(5)) to_chat(M, "You feel like you can't live without [name]!") if(prob(5)) to_chat(M, "You would DIE for some [name] right now!") + return update_flags diff --git a/code/modules/reagents/chemistry/reagents/admin.dm b/code/modules/reagents/chemistry/reagents/admin.dm index 785ac17a598..0856955da2b 100644 --- a/code/modules/reagents/chemistry/reagents/admin.dm +++ b/code/modules/reagents/chemistry/reagents/admin.dm @@ -9,42 +9,42 @@ taste_message = "admin abuse" /datum/reagent/medicine/adminordrazine/on_mob_life(mob/living/carbon/M) - M.setCloneLoss(0) - M.setOxyLoss(0) + M.setCloneLoss(0, FALSE) + M.setOxyLoss(0, FALSE) M.radiation = 0 - M.adjustBruteLoss(-5) - M.adjustFireLoss(-5) - M.adjustToxLoss(-5) - M.setBrainLoss(0) + M.adjustBruteLoss(-5, FALSE) + M.adjustFireLoss(-5, FALSE) + M.adjustToxLoss(-5, FALSE) + M.setBrainLoss(0, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M for(var/thing in H.internal_organs) var/obj/item/organ/internal/I = thing - I.receive_damage(-5) + I.receive_damage(-5, FALSE) for(var/obj/item/organ/external/E in H.bodyparts) if(E.mend_fracture()) E.perma_injury = 0 - M.SetEyeBlind(0) - M.CureNearsighted() - M.CureBlind() + M.SetEyeBlind(0, FALSE) + M.CureNearsighted(FALSE) + M.CureBlind(FALSE) M.CureMute() M.CureDeaf() M.CureEpilepsy() M.CureTourettes() M.CureCoughing() M.CureNervous() - M.SetEyeBlurry(0) - M.SetWeakened(0) - M.SetStunned(0) - M.SetParalysis(0) - M.SetSilence(0) + M.SetEyeBlurry(0, FALSE) + M.SetWeakened(0, FALSE) + M.SetStunned(0, FALSE) + M.SetParalysis(0, FALSE) + M.SetSilence(0, FALSE) M.SetHallucinate(0) M.SetDizzy(0) M.SetDrowsy(0) M.SetStuttering(0) M.SetSlur(0) M.SetConfused(0) - M.SetSleeping(0) + M.SetSleeping(0, FALSE) M.SetJitter(0) for(var/thing in M.viruses) var/datum/disease/D = thing @@ -52,6 +52,7 @@ continue D.cure(0) ..() + return STATUS_UPDATE_ALL /datum/reagent/medicine/adminordrazine/nanites name = "Nanites" diff --git a/code/modules/reagents/chemistry/reagents/alcohol.dm b/code/modules/reagents/chemistry/reagents/alcohol.dm index 33f4ef4263c..c74e5973bf7 100644 --- a/code/modules/reagents/chemistry/reagents/alcohol.dm +++ b/code/modules/reagents/chemistry/reagents/alcohol.dm @@ -13,7 +13,7 @@ /datum/reagent/consumable/ethanol/on_mob_life(mob/living/M) M.AdjustDrunk(alcohol_perc) M.AdjustDizzy(dizzy_adj) - ..() + return ..() /datum/reagent/consumable/ethanol/reaction_obj(obj/O, volume) if(istype(O,/obj/item/paper)) @@ -103,10 +103,12 @@ //copy paste from LSD... shoot me /datum/reagent/consumable/ethanol/absinthe/on_mob_life(mob/living/M) M.AdjustHallucinate(5) - ..() + return ..() /datum/reagent/consumable/ethanol/absinthe/overdose_process(mob/living/M, severity) - M.adjustToxLoss(1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + return list(0, update_flags) /datum/reagent/consumable/ethanol/rum name = "Rum" @@ -121,7 +123,9 @@ drink_desc = "Now you want to Pray for a pirate suit, don't you?" /datum/reagent/consumable/ethanol/rum/overdose_process(mob/living/M, severity) - M.adjustToxLoss(1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + return list(0, update_flags) /datum/reagent/consumable/ethanol/mojito name = "Mojito" @@ -237,12 +241,13 @@ taste_message = "party" /datum/reagent/consumable/ethanol/thirteenloko/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-7) - M.AdjustSleeping(-2) + update_flags |= M.AdjustSleeping(-2, FALSE) if(M.bodytemperature > 310) M.bodytemperature = max(310, M.bodytemperature - (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) M.Jitter(5) - ..() + return ..() | update_flags /////////////////////////////////////////////////////////////////cocktail entities////////////////////////////////////////////// @@ -475,7 +480,7 @@ /datum/reagent/consumable/ethanol/toxins_special/on_mob_life(mob/living/M) if(M.bodytemperature < 330) M.bodytemperature = min(330, M.bodytemperature + (15 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310 is the normal bodytemp. 310.055 - ..() + return ..() /datum/reagent/consumable/ethanol/beepsky_smash name = "Beepsky Smash" @@ -491,8 +496,9 @@ taste_message = "THE LAW" /datum/reagent/consumable/ethanol/beepsky_smash/on_mob_life(mob/living/M) - M.Stun(1) - ..() + var/update_flag = STATUS_UPDATE_NONE + update_flag |= M.Stun(1, FALSE) + return ..() | update_flag /datum/reagent/consumable/ethanol/irish_cream name = "Irish Cream" @@ -640,7 +646,7 @@ /datum/reagent/consumable/ethanol/antifreeze/on_mob_life(mob/living/M) if(M.bodytemperature < 330) M.bodytemperature = min(330, M.bodytemperature + (20 * TEMPERATURE_DAMAGE_COEFFICIENT)) //310 is the normal bodytemp. 310.055 - ..() + return ..() /datum/reagent/consumable/ethanol/barefoot name = "Barefoot" @@ -888,13 +894,14 @@ taste_message = "brain damageeeEEeee" /datum/reagent/consumable/ethanol/neurotoxin/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(current_cycle >= 13) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) if(current_cycle >= 55) - M.Druggy(55) + update_flags |= M.Druggy(55, FALSE) if(current_cycle >= 200) - M.adjustToxLoss(2) - ..() + update_flags |= M.adjustToxLoss(2, FALSE) + return ..() | update_flags /datum/reagent/consumable/ethanol/hippies_delight name = "Hippie's Delight" @@ -908,25 +915,29 @@ drink_desc = "A drink enjoyed by people during the 1960's." /datum/reagent/consumable/ethanol/hippies_delight/on_mob_life(mob/living/M) - M.Druggy(50) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Druggy(50, FALSE) switch(current_cycle) if(1 to 5) - if(!M.stuttering) M.stuttering = 1 + M.Stuttering(1) M.Dizzy(10) - if(prob(10)) M.emote(pick("twitch","giggle")) + if(prob(10)) + M.emote(pick("twitch","giggle")) if(5 to 10) - if(!M.stuttering) M.stuttering = 1 + M.Stuttering(1) M.Jitter(20) M.Dizzy(20) - M.Druggy(45) - if(prob(20)) M.emote(pick("twitch","giggle")) + update_flags |= M.Druggy(45, FALSE) + if(prob(20)) + M.emote(pick("twitch","giggle")) if(10 to INFINITY) - if(!M.stuttering) M.stuttering = 1 + M.Stuttering(1) M.Jitter(40) M.Dizzy(40) - M.Druggy(60) - if(prob(30)) M.emote(pick("twitch","giggle")) - ..() + update_flags |= M.Druggy(60, FALSE) + if(prob(30)) + M.emote(pick("twitch","giggle")) + return ..() | update_flags /datum/reagent/consumable/ethanol/changelingsting name = "Changeling Sting" @@ -993,8 +1004,8 @@ /datum/reagent/consumable/ethanol/driestmartini/on_mob_life(mob/living/M) if(current_cycle >= 55 && current_cycle < 115) - M.stuttering += 10 - ..() + M.AdjustStuttering(10) + return ..() /datum/reagent/consumable/ethanol/kahlua name = "Kahlua" @@ -1008,11 +1019,12 @@ taste_message = "sweet alcohol" /datum/reagent/consumable/ethanol/kahlua/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDizzy(-5) M.AdjustDrowsy(-3) - M.AdjustSleeping(-2) + update_flags |= (M.AdjustSleeping(-2) ? STATUS_UPDATE_STAT : STATUS_UPDATE_NONE) M.Jitter(5) - ..() + return ..() | update_flags /datum/reagent/ginsonic name = "Gin and sonic" @@ -1026,11 +1038,12 @@ taste_message = "SPEED" /datum/reagent/ginsonic/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) if(prob(25)) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) if(prob(8)) M.reagents.add_reagent("methamphetamine",1.2) var/sonic_message = pick("Gotta go fast!", "Time to speed, keed!", "I feel a need for speed!", "Let's juice.", "Juice time.", "Way Past Cool!") @@ -1038,7 +1051,7 @@ M.say("[sonic_message]") else to_chat(M, "[sonic_message ]") - ..() + return ..() | update_flags /datum/reagent/consumable/ethanol/applejack name = "Applejack" @@ -1101,6 +1114,7 @@ M.adjust_fire_stacks(3) /datum/reagent/consumable/ethanol/dragons_breath/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(M.reagents.has_reagent("milk")) to_chat(M, "The milk stops the burning. Ahhh.") M.reagents.del_reagent("milk") @@ -1111,7 +1125,7 @@ if(prob(50)) to_chat(M, "Your throat burns terribly!") M.emote(pick("scream","cry","choke","gasp")) - M.Stun(1) + update_flags |= M.Stun(1, FALSE) if(prob(8)) to_chat(M, "Why!? WHY!?") if(prob(8)) @@ -1125,7 +1139,7 @@ M.visible_message("[M] is consumed in flames!") M.dust() return - ..() + return ..() | update_flags // ROBOT ALCOHOL PAST THIS POINT // WOOO! diff --git a/code/modules/reagents/chemistry/reagents/disease.dm b/code/modules/reagents/chemistry/reagents/disease.dm index bac6f475261..a9cbbe87691 100644 --- a/code/modules/reagents/chemistry/reagents/disease.dm +++ b/code/modules/reagents/chemistry/reagents/disease.dm @@ -11,7 +11,7 @@ if(iscarbon(M)) if(!M.get_int_organ(/obj/item/organ/internal/body_egg)) new/obj/item/organ/internal/body_egg/spider_eggs(M) //Yes, even Xenos can fall victim to the plague that is spider infestation. - ..() + return ..() /datum/reagent/nanomachines @@ -24,7 +24,7 @@ /datum/reagent/nanomachines/on_mob_life(mob/living/carbon/M) if(volume > 1.5) M.ForceContractDisease(new /datum/disease/transformation/robot(0)) - ..() + return ..() /datum/reagent/xenomicrobes @@ -37,7 +37,7 @@ /datum/reagent/xenomicrobes/on_mob_life(mob/living/carbon/M) if(volume > 1.5) M.ContractDisease(new /datum/disease/transformation/xeno(0)) - ..() + return ..() /datum/reagent/fungalspores name = "Tubercle bacillus Cosmosis microbes" @@ -49,7 +49,7 @@ /datum/reagent/fungalspores/on_mob_life(mob/living/carbon/M) if(volume > 2.5) M.ForceContractDisease(new /datum/disease/tuberculosis(0)) - ..() + return ..() /datum/reagent/jagged_crystals name = "Jagged Crystals" @@ -61,7 +61,7 @@ /datum/reagent/jagged_crystals/on_mob_life(mob/living/carbon/M) M.ForceContractDisease(new /datum/disease/berserker(0)) - ..() + return ..() /datum/reagent/salmonella name = "Salmonella" @@ -73,7 +73,7 @@ /datum/reagent/salmonella/on_mob_life(mob/living/carbon/M) M.ForceContractDisease(new /datum/disease/food_poisoning(0)) - ..() + return ..() /datum/reagent/gibbis name = "Gibbis" @@ -86,7 +86,7 @@ /datum/reagent/gibbis/on_mob_life(mob/living/carbon/M) if(volume > 2.5) M.ForceContractDisease(new /datum/disease/gbs/curable(0)) - ..() + return ..() /datum/reagent/prions name = "Prions" @@ -99,7 +99,7 @@ /datum/reagent/prions/on_mob_life(mob/living/carbon/M) if(volume > 4.5) M.ForceContractDisease(new /datum/disease/kuru(0)) - ..() + return ..() /datum/reagent/grave_dust name = "Grave Dust" @@ -112,7 +112,7 @@ /datum/reagent/grave_dust/on_mob_life(mob/living/carbon/M) if(volume > 4.5) M.ForceContractDisease(new /datum/disease/vampire(0)) - ..() + return ..() /datum/reagent/heartworms name = "Space heartworms" @@ -130,7 +130,7 @@ if(ate_heart) ate_heart.remove(H) qdel(ate_heart) - ..() + return ..() /datum/reagent/concentrated_initro name = "Concentrated Initropidril" @@ -146,7 +146,7 @@ var/mob/living/carbon/human/H = M if(!H.undergoing_cardiac_arrest()) H.set_heartattack(TRUE) // rip in pepperoni - ..() + return ..() //virus foods diff --git a/code/modules/reagents/chemistry/reagents/drink_base.dm b/code/modules/reagents/chemistry/reagents/drink_base.dm index a924d84349b..4f20e323049 100644 --- a/code/modules/reagents/chemistry/reagents/drink_base.dm +++ b/code/modules/reagents/chemistry/reagents/drink_base.dm @@ -11,16 +11,17 @@ var/adj_temp_cool = 0 /datum/reagent/consumable/drink/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(adj_dizzy) M.AdjustDizzy(adj_dizzy) if(adj_drowsy) M.AdjustDrowsy(adj_drowsy) if(adj_sleepy) - M.AdjustSleeping(adj_sleepy) + update_flags |= M.AdjustSleeping(adj_sleepy, FALSE) if(adj_temp_hot) if(M.bodytemperature < 310)//310 is the normal bodytemp. 310.055 M.bodytemperature = min(310, M.bodytemperature + (adj_temp_hot * TEMPERATURE_DAMAGE_COEFFICIENT)) if(adj_temp_cool) if(M.bodytemperature > 310)//310 is the normal bodytemp. 310.055 M.bodytemperature = max(310, M.bodytemperature - (adj_temp_cool * TEMPERATURE_DAMAGE_COEFFICIENT)) - ..() + return ..() | update_flags diff --git a/code/modules/reagents/chemistry/reagents/drink_cold.dm b/code/modules/reagents/chemistry/reagents/drink_cold.dm index a92d8644c6b..1a7be3748b8 100644 --- a/code/modules/reagents/chemistry/reagents/drink_cold.dm +++ b/code/modules/reagents/chemistry/reagents/drink_cold.dm @@ -65,12 +65,13 @@ taste_message = "cola" /datum/reagent/consumable/drink/cold/nuka_cola/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.Jitter(20) - M.Druggy(30) + update_flags |= M.Druggy(30, FALSE) M.AdjustDizzy(5) M.SetDrowsy(0) M.status_flags |= GOTTAGOFAST - ..() + return ..() | update_flags /datum/reagent/consumable/drink/cold/nuka_cola/on_mob_delete(mob/living/M) M.status_flags &= ~GOTTAGOFAST @@ -172,4 +173,4 @@ /datum/reagent/consumable/drink/cold/rewriter/on_mob_life(mob/living/M) M.Jitter(5) - ..() + return ..() diff --git a/code/modules/reagents/chemistry/reagents/drinks.dm b/code/modules/reagents/chemistry/reagents/drinks.dm index cf73e0a5087..b6b4a27e10d 100644 --- a/code/modules/reagents/chemistry/reagents/drinks.dm +++ b/code/modules/reagents/chemistry/reagents/drinks.dm @@ -9,9 +9,10 @@ taste_message = "orange juice" /datum/reagent/consumable/drink/orangejuicde/on_mob_life(mob/living/M) - if(M.getOxyLoss() && prob(30)) - M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(30)) + update_flags |= M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/tomatojuice name = "Tomato Juice" @@ -34,9 +35,10 @@ taste_message = "pineapple juice" /datum/reagent/consumable/drink/tomatojuice/on_mob_life(mob/living/M) - if(M.getFireLoss() && prob(20)) - M.adjustFireLoss(-1) - ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(20)) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/limejuice name = "Lime Juice" @@ -49,9 +51,10 @@ taste_message = "lime juice" /datum/reagent/consumable/drink/limejuice/on_mob_life(mob/living/M) - if(M.getToxLoss() && prob(20)) - M.adjustToxLoss(-1) - ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(20)) + update_flags |= M.adjustToxLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/carrotjuice name = "Carrot juice" @@ -63,16 +66,17 @@ drink_desc = "It is just like a carrot but without crunching." taste_message = "carrot juice" -/datum/reagent/consumable/drink/carrotjuicde/on_mob_life(mob/living/M) - M.AdjustEyeBlurry(-1) - M.AdjustEyeBlind(-1) +/datum/reagent/consumable/drink/carrotjuice/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.AdjustEyeBlurry(-1, FALSE) + update_flags |= M.AdjustEyeBlind(-1, FALSE) switch(current_cycle) if(1 to 20) //nothing if(21 to INFINITY) if(prob(current_cycle-10)) - M.disabilities &= ~NEARSIGHTED - ..() + update_flags |= M.CureNearsighted(FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/doctor_delight name = "The Doctor's Delight" @@ -86,9 +90,10 @@ taste_message = "healthy dietary choices" /datum/reagent/consumable/drink/doctors_delight/on_mob_life(mob/living/M) - if(M.getToxLoss() && prob(20)) - M.adjustToxLoss(-1) - ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(20)) + update_flags |= M.adjustToxLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/triple_citrus name = "Triple Citrus" @@ -126,8 +131,9 @@ taste_message = "berry juice" /datum/reagent/consumable/drink/poisonberryjuice/on_mob_life(mob/living/M) - M.adjustToxLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/consumable/applejuice name = "Apple Juice" @@ -171,10 +177,11 @@ taste_message = "banana juice" /datum/reagent/consumable/drink/banana/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if((ishuman(M) && M.job in list("Clown") ) || issmall(M)) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/nothing name = "Nothing" @@ -186,10 +193,11 @@ taste_message = "nothing... how?" /datum/reagent/consumable/drink/nothing/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M) && M.job in list("Mime")) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/potato_juice name = "Potato Juice" @@ -213,11 +221,12 @@ taste_message = "milk" /datum/reagent/consumable/drink/milk/on_mob_life(mob/living/M) - if(M.getBruteLoss() && prob(20)) - M.adjustBruteLoss(-1) + var/update_flags = STATUS_UPDATE_NONE + if(prob(20)) + update_flags |= M.adjustBruteLoss(-1, FALSE) if(holder.has_reagent("capsaicin")) holder.remove_reagent("capsaicin", 2) - ..() + return ..() | update_flags /datum/reagent/consumable/drink/milk/soymilk name = "Soy Milk" @@ -275,13 +284,14 @@ taste_message = "coffee" /datum/reagent/consumable/drink/coffee/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(holder.has_reagent("frostoil")) holder.remove_reagent("frostoil", 5) if(prob(50)) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) - ..() + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/coffee/overdose_process(mob/living/M, severity) if(volume > 45) @@ -311,10 +321,11 @@ drink_desc = "A nice and refrshing beverage while you are reading." /datum/reagent/consumable/drink/coffee/soy_latte/on_mob_life(mob/living/M) - ..() - M.SetSleeping(0) - if(M.getBruteLoss() && prob(20)) - M.adjustBruteLoss(-1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.SetSleeping(0, FALSE) + if(prob(20)) + update_flags |= M.adjustBruteLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/coffee/cafe_latte name = "Cafe Latte" @@ -328,10 +339,11 @@ drink_desc = "A nice, strong and refreshing beverage while you are reading." /datum/reagent/consumable/drink/coffee/cafe_latte/on_mob_life(mob/living/M) - ..() - M.SetSleeping(0) - if(M.getBruteLoss() && prob(20)) - M.adjustBruteLoss(-1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.SetSleeping(0, FALSE) + if(prob(20)) + update_flags |= M.adjustBruteLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/coffee/cafe_latte/cafe_mocha name = "Cafe Mocha" @@ -357,9 +369,10 @@ taste_message = "tea" /datum/reagent/consumable/drink/tea/on_mob_life(mob/living/M) - if(M.getToxLoss() && prob(20)) - M.adjustToxLoss(-1) - ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(20)) + update_flags |= M.adjustToxLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/tea/icetea name = "Iced Tea" @@ -383,10 +396,11 @@ taste_message = "honks" /datum/reagent/consumable/drink/bananahonk/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if((ishuman(M) && M.job in list("Clown") ) || issmall(M)) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/silencer name = "Silencer" @@ -399,10 +413,11 @@ taste_message = "mphhhh" /datum/reagent/consumable/drink/silencer/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M) && M.job in list("Mime")) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/drink/chocolatepudding name = "Chocolate Pudding" diff --git a/code/modules/reagents/chemistry/reagents/drugs.dm b/code/modules/reagents/chemistry/reagents/drugs.dm index 77c4b08f359..980c6d5bf9d 100644 --- a/code/modules/reagents/chemistry/reagents/drugs.dm +++ b/code/modules/reagents/chemistry/reagents/drugs.dm @@ -10,7 +10,7 @@ if(ishuman(M)) if(prob(7)) M.emote(pick("twitch","drool","moan","gasp")) - ..() + return ..() /datum/reagent/lithium @@ -24,8 +24,9 @@ if(isturf(M.loc) && !istype(M.loc, /turf/space)) if(M.canmove && !M.restrained()) step(M, pick(cardinal)) - if(prob(5)) M.emote(pick("twitch","drool","moan")) - ..() + if(prob(5)) + M.emote(pick("twitch","drool","moan")) + return ..() /datum/reagent/lsd name = "Lysergic acid diethylamide" @@ -35,9 +36,10 @@ color = "#0000D8" /datum/reagent/lsd/on_mob_life(mob/living/M) - M.Druggy(15) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Druggy(15, FALSE) M.AdjustHallucinate(10) - ..() + return ..() | update_flags /datum/reagent/space_drugs name = "Space drugs" @@ -50,12 +52,14 @@ heart_rate_decrease = 1 /datum/reagent/space_drugs/on_mob_life(mob/living/M) - M.Druggy(15) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Druggy(15, FALSE) if(isturf(M.loc) && !istype(M.loc, /turf/space)) if(M.canmove && !M.restrained()) step(M, pick(cardinal)) - if(prob(7)) M.emote(pick("twitch","drool","moan","giggle")) - ..() + if(prob(7)) + M.emote(pick("twitch","drool","moan","giggle")) + return ..() | update_flags /datum/reagent/psilocybin name = "Psilocybin" @@ -64,25 +68,29 @@ color = "#E700E7" // rgb: 231, 0, 231 /datum/reagent/psilocybin/on_mob_life(mob/living/M) - M.Druggy(30) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Druggy(30, FALSE) switch(current_cycle) if(1 to 5) M.Stuttering(1) M.Dizzy(5) - if(prob(10)) M.emote(pick("twitch","giggle")) + if(prob(10)) + M.emote(pick("twitch","giggle")) if(5 to 10) M.Stuttering(1) M.Jitter(10) M.Dizzy(10) - M.Druggy(35) - if(prob(20)) M.emote(pick("twitch","giggle")) + update_flags |= M.Druggy(35, FALSE) + if(prob(20)) + M.emote(pick("twitch","giggle")) if(10 to INFINITY) M.Stuttering(1) M.Jitter(20) M.Dizzy(20) - M.Druggy(40) - if(prob(30)) M.emote(pick("twitch","giggle")) - ..() + update_flags |= M.Druggy(40, FALSE) + if(prob(30)) + M.emote(pick("twitch","giggle")) + return ..() | update_flags /datum/reagent/nicotine name = "Nicotine" @@ -95,55 +103,59 @@ heart_rate_increase = 1 /datum/reagent/nicotine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE var/smoke_message = pick("You feel relaxed.", "You feel calmed.", "You feel less stressed.", "You feel more placid.", "You feel more undivided.") if(prob(5)) to_chat(M, "[smoke_message]") if(prob(50)) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) - M.adjustStaminaLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) + update_flags |= M.adjustStaminaLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/nicotine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] looks nervous!") M.AdjustConfused(15) - M.adjustToxLoss(2) + update_flags |= M.adjustToxLoss(2, FALSE) M.Jitter(10) M.emote("twitch_s") else if(effect <= 4) M.visible_message("[M] is all sweaty!") M.bodytemperature += rand(15,30) - M.adjustToxLoss(3) + update_flags |= M.adjustToxLoss(3, FALSE) else if(effect <= 7) - M.adjustToxLoss(4) + update_flags |= M.adjustToxLoss(4, FALSE) M.emote("twitch") M.Jitter(10) else if(severity == 2) if(effect <= 2) M.emote("gasp") to_chat(M, "You can't breathe!") - M.adjustOxyLoss(15) - M.adjustToxLoss(3) - M.Stun(1) + update_flags |= M.adjustOxyLoss(15, FALSE) + update_flags |= M.adjustToxLoss(3, FALSE) + update_flags |= M.Stun(1, FALSE) else if(effect <= 4) to_chat(M, "You feel terrible!") M.emote("drool") M.Jitter(10) - M.adjustToxLoss(5) - M.Weaken(1) + update_flags |= M.adjustToxLoss(5, FALSE) + update_flags |= M.Weaken(1, FALSE) M.AdjustConfused(33) else if(effect <= 7) M.emote("collapse") to_chat(M, "Your heart is pounding!") M << 'sound/effects/singlebeat.ogg' - M.Paralyse(5) + update_flags |= M.Paralyse(5, FALSE) M.Jitter(30) - M.adjustToxLoss(6) - M.adjustOxyLoss(20) + update_flags |= M.adjustToxLoss(6, FALSE) + update_flags |= M.adjustOxyLoss(20, FALSE) + return list(effect, update_flags) /datum/reagent/crank name = "Crank" @@ -155,9 +167,10 @@ addiction_chance = 50 /datum/reagent/crank/on_mob_life(mob/living/M) - M.AdjustParalysis(-2) - M.AdjustStunned(-2) - M.AdjustWeakened(-2) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.AdjustParalysis(-2, FALSE) + update_flags |= M.AdjustStunned(-2, FALSE) + update_flags |= M.AdjustWeakened(-2, FALSE) if(prob(15)) M.emote(pick("twitch", "twitch_s", "grumble", "laugh")) if(prob(8)) @@ -169,13 +182,15 @@ M.bodytemperature += rand(1,10) if(prob(4)) to_chat(M, "You feel kinda awful!") - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) M.AdjustJitter(30) M.emote(pick("groan", "moan")) - ..() + return ..() | update_flags /datum/reagent/crank/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] looks confused!") @@ -185,9 +200,9 @@ else if(effect <= 4) M.visible_message("[M] is all sweaty!") M.bodytemperature += rand(5,30) - M.adjustBrainLoss(1) - M.adjustToxLoss(1) - M.Stun(2) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.Stun(2, FALSE) else if(effect <= 7) M.Jitter(30) M.emote("grumble") @@ -195,14 +210,14 @@ if(effect <= 2) M.visible_message("[M] is sweating like a pig!") M.bodytemperature += rand(20,100) - M.adjustToxLoss(5) - M.Stun(3) + update_flags |= M.adjustToxLoss(5, FALSE) + update_flags |= M.Stun(3, FALSE) else if(effect <= 4) M.visible_message("[M] starts tweaking the hell out!") M.Jitter(100) - M.adjustToxLoss(2) - M.adjustBrainLoss(8) - M.Weaken(3) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBrainLoss(8, FALSE) + update_flags |= M.Weaken(3, FALSE) M.AdjustConfused(25) M.emote("scream") M.reagents.add_reagent("jagged_crystals", 5) @@ -210,8 +225,9 @@ M.emote("scream") M.visible_message("[M] nervously scratches at [M.p_their()] skin!") M.Jitter(10) - M.adjustBruteLoss(5) + update_flags |= M.adjustBruteLoss(5, FALSE) M.emote("twitch_s") + return list(effect, update_flags) /datum/reagent/krokodil name = "Krokodil" @@ -224,9 +240,10 @@ /datum/reagent/krokodil/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustJitter(-40) if(prob(25)) - M.adjustBrainLoss(1) + update_flags |= M.adjustBrainLoss(1, FALSE) if(prob(15)) M.emote(pick("smile", "grin", "yawn", "laugh", "drool")) if(prob(10)) @@ -236,49 +253,52 @@ if(prob(5)) to_chat(M, "You feel too chill!") M.emote(pick("yawn", "drool")) - M.Stun(1) - M.adjustToxLoss(1) - M.adjustBrainLoss(1) + update_flags |= M.Stun(1, FALSE) + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) M.bodytemperature -= 20 if(prob(2)) to_chat(M, "Your skin feels all rough and dry.") - M.adjustBruteLoss(2) - ..() + update_flags |= M.adjustBruteLoss(2, FALSE) + return ..() | update_flags /datum/reagent/krokodil/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] looks dazed!") - M.Stun(3) + update_flags |= M.Stun(3, FALSE) M.emote("drool") else if(effect <= 4) M.emote("shiver") M.bodytemperature -= 40 else if(effect <= 7) to_chat(M, "Your skin is cracking and bleeding!") - M.adjustBruteLoss(5) - M.adjustToxLoss(2) - M.adjustBrainLoss(1) + update_flags |= M.adjustBruteLoss(5, FALSE) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) M.emote("cry") else if(severity == 2) if(effect <= 2) M.visible_message("[M] sways and falls over!") - M.adjustToxLoss(3) - M.adjustBrainLoss(3) - M.Weaken(8) + update_flags |= M.adjustToxLoss(3, FALSE) + update_flags |= M.adjustBrainLoss(3, FALSE) + update_flags |= M.Weaken(8, FALSE) M.emote("faint") else if(effect <= 4) if(ishuman(M)) var/mob/living/carbon/human/H = M H.visible_message("[M]'s skin is rotting away!") - H.adjustBruteLoss(25) + update_flags |= H.adjustBruteLoss(25, FALSE) H.emote("scream") H.ChangeToHusk() H.emote("faint") else if(effect <= 7) M.emote("shiver") M.bodytemperature -= 70 + return list(effect, update_flags) /datum/reagent/methamphetamine name = "Methamphetamine" @@ -292,32 +312,35 @@ heart_rate_increase = 1 /datum/reagent/methamphetamine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(5)) M.emote(pick("twitch_s","blink_r","shiver")) if(current_cycle >= 25) M.AdjustJitter(5) M.AdjustDrowsy(-10) - M.AdjustParalysis(-2.5) - M.AdjustStunned(-2.5) - M.AdjustWeakened(-2.5) - M.adjustStaminaLoss(-2) - M.SetSleeping(0) + update_flags |= M.AdjustParalysis(-2.5, FALSE) + update_flags |= M.AdjustStunned(-2.5, FALSE) + update_flags |= M.AdjustWeakened(-2.5, FALSE) + update_flags |= M.adjustStaminaLoss(-2, FALSE) + update_flags |= M.SetSleeping(0, FALSE) M.status_flags |= GOTTAGOFAST_METH if(prob(50)) - M.adjustBrainLoss(1.0) - ..() + update_flags |= M.adjustBrainLoss(1, FALSE) + return ..() | update_flags /datum/reagent/methamphetamine/on_mob_delete(mob/living/M) M.status_flags &= ~GOTTAGOFAST_METH ..() /datum/reagent/methamphetamine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] can't seem to control [M.p_their()] legs!") M.AdjustConfused(20) - M.Weaken(4) + update_flags |= M.Weaken(4, FALSE) else if(effect <= 4) M.visible_message("[M]'s hands flip out and flail everywhere!") M.drop_l_hand() @@ -332,9 +355,10 @@ else if(effect <= 4) M.visible_message("[M] falls to the floor and flails uncontrollably!") M.Jitter(10) - M.Weaken(10) + update_flags |= M.Weaken(10, FALSE) else if(effect <= 7) M.emote("laugh") + return list(effect, update_flags) /datum/reagent/bath_salts name = "Bath Salts" @@ -348,6 +372,7 @@ /datum/reagent/bath_salts/on_mob_life(mob/living/M) var/check = rand(0,100) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head_organ = H.get_organ("head") @@ -358,25 +383,25 @@ H.update_fhair() H.visible_message("[H] has a wild look in [H.p_their()] eyes!") if(check < 60) - M.SetParalysis(0) - M.SetStunned(0) - M.SetWeakened(0) + update_flags |= M.SetParalysis(0, FALSE) + update_flags |= M.SetStunned(0, FALSE) + update_flags |= M.SetWeakened(0, FALSE) if(check < 30) M.emote(pick("twitch", "twitch_s", "scream", "drool", "grumble", "mumble")) - M.Druggy(15) + update_flags |= M.Druggy(15, FALSE) if(check < 20) M.AdjustConfused(10) if(check < 8) M.reagents.add_reagent(pick("methamphetamine", "crank", "neurotoxin"), rand(1,5)) M.visible_message("[M] scratches at something under [M.p_their()] skin!") - M.adjustBruteLoss(5) + update_flags |= M.adjustBruteLoss(5, FALSE) else if(check < 16) M.AdjustHallucinate(30) else if(check < 24) to_chat(M, "They're coming for you!") else if(check < 28) to_chat(M, "THEY'RE GONNA GET YOU!") - ..() + return ..() | update_flags /datum/reagent/bath_salts/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == INGEST) @@ -390,7 +415,9 @@ to_chat(M, "You feel a bit more salty than usual.") /datum/reagent/bath_salts/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] flails around like a lunatic!") @@ -401,10 +428,10 @@ else if(effect <= 4) M.visible_message("[M]'s eyes dilate!") M.emote("twitch_s") - M.adjustToxLoss(2) - M.adjustBrainLoss(1) - M.Stun(3) - M.EyeBlurry(7) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.Stun(3, FALSE) + update_flags |= M.EyeBlurry(7, FALSE) M.reagents.add_reagent("jagged_crystals", 5) else if(effect <= 7) M.emote("faint") @@ -412,25 +439,26 @@ else if(severity == 2) if(effect <= 2) M.visible_message("[M]'s eyes dilate!") - M.adjustToxLoss(2) - M.adjustBrainLoss(1) - M.Stun(3) - M.EyeBlurry(7) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.Stun(3, FALSE) + update_flags |= M.EyeBlurry(7, FALSE) M.reagents.add_reagent("jagged_crystals", 5) else if(effect <= 4) M.visible_message("[M] convulses violently and falls to the floor!") M.Jitter(50) - M.adjustToxLoss(2) - M.adjustBrainLoss(1) - M.Weaken(8) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.Weaken(8, FALSE) M.emote("gasp") M.reagents.add_reagent("jagged_crystals", 5) else if(effect <= 7) M.emote("scream") M.visible_message("[M] tears at [M.p_their()] own skin!") - M.adjustBruteLoss(5) + update_flags |= M.adjustBruteLoss(5, FALSE) M.reagents.add_reagent("jagged_crystals", 5) M.emote("twitch") + return list(effect, update_flags) /datum/reagent/jenkem name = "Jenkem" @@ -442,11 +470,12 @@ taste_message = "puke... or worse" /datum/reagent/jenkem/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.Dizzy(5) if(prob(10)) M.emote(pick("twitch_s","drool","moan")) - M.adjustToxLoss(1) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/aranesp name = "Aranesp" @@ -456,9 +485,10 @@ color = "#60A584" // rgb: 96, 165, 132 /datum/reagent/aranesp/on_mob_life(mob/living/M) - M.adjustStaminaLoss(-40) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustStaminaLoss(-40, FALSE) if(prob(90)) - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) if(prob(5)) M.emote(pick("twitch", "shake", "tremble","quiver", "twitch_s")) var/high_message = pick("really buff", "on top of the world","like you're made of steel", "energized", "invigorated", "full of energy") @@ -466,10 +496,10 @@ to_chat(M, "[high_message]!") if(prob(5)) to_chat(M, "You cannot breathe!") - M.adjustOxyLoss(15) - M.Stun(1) - M.AdjustLoseBreath(1) - ..() + update_flags |= M.adjustOxyLoss(15, FALSE) + update_flags |= M.Stun(1, FALSE) + M.AdjustLoseBreath(1, FALSE) + return ..() | update_flags /datum/reagent/thc name = "Tetrahydrocannabinol" @@ -489,7 +519,7 @@ if(volume >= 50 && prob(25)) if(prob(10)) M.Drowsy(10) - ..() + return ..() /datum/reagent/fliptonium name = "Fliptonium" @@ -504,6 +534,7 @@ taste_message = "flips" /datum/reagent/fliptonium/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(current_cycle == 5) M.SpinAnimation(speed = 11, loops = -1) if(current_cycle == 10) @@ -522,12 +553,12 @@ M.SpinAnimation(speed = 4, loops = -1) M.AdjustDrowsy(-6) - M.AdjustParalysis(-1.5) - M.AdjustStunned(-1.5) - M.AdjustWeakened(-1.5) - M.adjustStaminaLoss(-1.5) - M.SetSleeping(0) - ..() + update_flags |= M.AdjustParalysis(-1.5, FALSE) + update_flags |= M.AdjustStunned(-1.5, FALSE) + update_flags |= M.AdjustWeakened(-1.5, FALSE) + update_flags |= M.adjustStaminaLoss(-1.5, FALSE) + update_flags |= M.SetSleeping(0, FALSE) + return ..() | update_flags /datum/reagent/fliptonium/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == INGEST || method == TOUCH) @@ -538,12 +569,14 @@ M.SpinAnimation(speed = 12, loops = -1) /datum/reagent/fliptonium/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) M.visible_message("[M] can't seem to control [M.p_their()] legs!") M.AdjustConfused(33) - M.Weaken(2) + update_flags |= M.Weaken(2, FALSE) else if(effect <= 4) M.visible_message("[M]'s hands flip out and flail everywhere!") M.drop_l_hand() @@ -558,9 +591,10 @@ else if(effect <= 4) M.visible_message("[M] falls to the floor and flails uncontrollably!") M.Jitter(5) - M.Weaken(5) + update_flags |= M.Weaken(5, FALSE) else if(effect <= 7) M.emote("laugh") + return list(effect, update_flags) ////////////////////////////// // Synth-Drugs // @@ -580,28 +614,32 @@ taste_message = "wiper fluid" /datum/reagent/lube/ultra/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE var/high_message = pick("You feel your servos whir!", "You feel like you need to go faster.", "You feel like you were just overclocked!") if(prob(1)) if(prob(1)) high_message = "0100011101001111010101000101010001000001010001110100111101000110010000010101001101010100!" if(prob(5)) to_chat(M, "[high_message]") - M.AdjustParalysis(-2) - M.AdjustStunned(-2) - M.AdjustWeakened(-2) - M.adjustStaminaLoss(-2) + update_flags |= M.AdjustParalysis(-2, FALSE) + update_flags |= M.AdjustStunned(-2, FALSE) + update_flags |= M.AdjustWeakened(-2, FALSE) + update_flags |= M.adjustStaminaLoss(-2, FALSE) M.status_flags |= GOTTAGOFAST_METH M.Jitter(3) - M.adjustBrainLoss(0.5) + update_flags |= M.adjustBrainLoss(0.5, FALSE) if(prob(5)) M.emote(pick("twitch", "shiver")) - ..() + return ..() | update_flags /datum/reagent/lube/ultra/on_mob_delete(mob/living/M) M.status_flags &= ~GOTTAGOFAST_METH ..() /datum/reagent/lube/ultra/overdose_process(mob/living/M, severity) + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(prob(20)) M.emote("ping") if(prob(33)) @@ -610,9 +648,9 @@ if(I) M.drop_item() if(prob(50)) - M.adjustFireLoss(10) - M.adjustBrainLoss(pick(0.5, 0.6, 0.7, 0.8, 0.9, 1)) - ..() + update_flags |= M.adjustFireLoss(10, FALSE) + update_flags |= M.adjustBrainLoss(pick(0.5, 0.6, 0.7, 0.8, 0.9, 1), FALSE) + return list(effect, update_flags) //Surge: Krokodil /datum/reagent/surge @@ -629,19 +667,21 @@ /datum/reagent/surge/on_mob_life(mob/living/M) - M.Druggy(15) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Druggy(15) var/high_message = pick("You feel calm.", "You feel collected.", "You feel like you need to relax.") if(prob(1)) if(prob(1)) high_message = "01010100010100100100000101001110010100110100001101000101010011100100010001000101010011100100001101000101." if(prob(5)) to_chat(M, "[high_message]") - ..() + return ..() | update_flags /datum/reagent/surge/overdose_process(mob/living/M, severity) + var/update_flags = STATUS_UPDATE_NONE //Hit them with the same effects as an electrode! - M.Stun(5) - M.Weaken(5) + update_flags |= M.Stun(5, FALSE) + update_flags |= M.Weaken(5, FALSE) M.Jitter(20) M.apply_effect(STUTTER, 5) if(prob(10)) @@ -654,5 +694,6 @@ B.pixel_x = rand(-20, 0) B.pixel_y = rand(-20, 0) B.icon = I - M.adjustFireLoss(rand(1,5)*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(rand(1,5)*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustFireLoss(rand(1,5)*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(rand(1,5)*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return list(0, update_flags) diff --git a/code/modules/reagents/chemistry/reagents/food.dm b/code/modules/reagents/chemistry/reagents/food.dm index 7426844e292..e42b30dc296 100644 --- a/code/modules/reagents/chemistry/reagents/food.dm +++ b/code/modules/reagents/chemistry/reagents/food.dm @@ -14,7 +14,7 @@ var/mob/living/carbon/human/H = M if(H.can_eat(diet_flags)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients H.nutrition += nutriment_factor // For hunger and fatness - ..() + return ..() /datum/reagent/consumable/nutriment // Pure nutriment, universally digestable and thus slightly less effective name = "Nutriment" @@ -25,16 +25,17 @@ color = "#664330" // rgb: 102, 67, 48 /datum/reagent/consumable/nutriment/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(!(M.mind in ticker.mode.vampires)) if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.can_eat(diet_flags)) //Make sure the species has it's dietflag set, otherwise it can't digest any nutrients if(prob(50)) - M.adjustBruteLoss(-1) + update_flags |= M.adjustBruteLoss(-1, FALSE) if(!(NO_BLOOD in H.dna.species.species_traits))//do not restore blood on things with no blood by nature. if(H.blood_volume < BLOOD_VOLUME_NORMAL) H.blood_volume += 0.4 - ..() + return ..() | update_flags /datum/reagent/consumable/nutriment/protein // Meat-based protein, digestable by carnivores and omnivores, worthless to herbivores name = "Protein" @@ -59,9 +60,10 @@ taste_message = null /datum/reagent/consumable/vitamin/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(50)) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) if(M.satiety < 600) M.satiety += 30 if(ishuman(M)) @@ -69,7 +71,7 @@ if(!(NO_BLOOD in H.dna.species.species_traits))//do not restore blood on things with no blood by nature. if(H.blood_volume < BLOOD_VOLUME_NORMAL) H.blood_volume += 0.5 - ..() + return ..() | update_flags /datum/reagent/consumable/sugar name = "Sugar" @@ -82,16 +84,17 @@ taste_message = "sweetness" /datum/reagent/consumable/sugar/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) if(current_cycle >= 90) M.AdjustJitter(2) if(prob(50)) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) if(prob(4)) M.reagents.add_reagent("epinephrine", 1.2) - ..() + return ..() | update_flags /datum/reagent/consumable/sugar/overdose_start(mob/living/M) to_chat(M, "You pass out from hyperglycemic shock!") @@ -99,10 +102,12 @@ ..() /datum/reagent/consumable/sugar/overdose_process(mob/living/M, severity) - M.Paralyse(3 * severity) - M.Weaken(4 * severity) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.Paralyse(3 * severity, FALSE) + update_flags |= M.Weaken(4 * severity, FALSE) if(prob(8)) - M.adjustToxLoss(severity) + update_flags |= M.adjustToxLoss(severity, FALSE) + return list(0, update_flags) /datum/reagent/consumable/soysauce name = "Soysauce" @@ -150,7 +155,7 @@ M.bodytemperature += 20 * TEMPERATURE_DAMAGE_COEFFICIENT if(isslime(M)) M.bodytemperature += rand(20,25) - ..() + return ..() /datum/reagent/consumable/condensedcapsaicin name = "Condensed Capsaicin" @@ -163,7 +168,7 @@ /datum/reagent/consumable/condensedcapsaicin/on_mob_life(mob/living/M) if(prob(5)) M.visible_message("[M] [pick("dry heaves!","coughs!","splutters!")]") - ..() + return ..() /datum/reagent/consumable/condensedcapsaicin/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == TOUCH) @@ -253,7 +258,7 @@ M.emote("shiver") if(isslime(M)) M.bodytemperature -= rand(20,25) - ..() + return ..() /datum/reagent/consumable/frostoil/reaction_turf(turf/T, volume) if(volume >= 5) @@ -270,9 +275,10 @@ taste_message = "salt" /datum/reagent/consumable/sodiumchloride/overdose_process(mob/living/M, severity) + var/update_flags = STATUS_UPDATE_NONE if(prob(70)) - M.adjustBrainLoss(1) - ..() + update_flags |= M.adjustBrainLoss(1, FALSE) + return ..() | update_flags /datum/reagent/consumable/blackpepper name = "Black Pepper" @@ -311,7 +317,7 @@ /datum/reagent/consumable/hot_coco/on_mob_life(mob/living/M) if(M.bodytemperature < 310)//310 is the normal bodytemp. 310.055 M.bodytemperature = min(310, M.bodytemperature + (5 * TEMPERATURE_DAMAGE_COEFFICIENT)) - ..() + return ..() /datum/reagent/consumable/sprinkles name = "Sprinkles" @@ -321,10 +327,11 @@ taste_message = "sweetness" /datum/reagent/consumable/sprinkles/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M) && M.job in list("Security Officer", "Security Pod Pilot", "Detective", "Warden", "Head of Security", "Brig Physician", "Internal Affairs Agent", "Magistrate")) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/cornoil name = "Corn Oil" @@ -376,7 +383,7 @@ /datum/reagent/consumable/hot_ramen/on_mob_life(mob/living/M) if(M.bodytemperature < 310)//310 is the normal bodytemp. 310.055 M.bodytemperature = min(310, M.bodytemperature + (10 * TEMPERATURE_DAMAGE_COEFFICIENT)) - ..() + return ..() /datum/reagent/consumable/hell_ramen name = "Hell Ramen" @@ -389,7 +396,7 @@ /datum/reagent/consumable/hell_ramen/on_mob_life(mob/living/M) M.bodytemperature += 10 * TEMPERATURE_DAMAGE_COEFFICIENT - ..() + return ..() /datum/reagent/consumable/flour name = "flour" @@ -461,7 +468,7 @@ /datum/reagent/consumable/corn_syrup/on_mob_life(mob/living/M) M.reagents.add_reagent("sugar", 1.2) - ..() + return ..() /datum/reagent/consumable/vhfcs name = "Very-high-fructose corn syrup" @@ -473,7 +480,7 @@ /datum/reagent/consumable/vhfcs/on_mob_life(mob/living/M) M.reagents.add_reagent("sugar", 2.4) - ..() + return ..() /datum/reagent/consumable/honey name = "Honey" @@ -485,11 +492,12 @@ taste_message = "sweetness" /datum/reagent/consumable/honey/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.reagents.add_reagent("sugar", 3) if(prob(20)) - M.adjustBruteLoss(-3) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustBruteLoss(-3, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/consumable/onion name = "Concentrated Onion Juice" @@ -524,7 +532,7 @@ /datum/reagent/consumable/chocolate/on_mob_life(mob/living/M) M.reagents.add_reagent("sugar", 0.8) - ..() + return ..() /datum/reagent/consumable/chocolate/reaction_turf(turf/T, volume) if(volume >= 5 && !isspaceturf(T)) @@ -539,13 +547,14 @@ taste_message = "tea" /datum/reagent/consumable/mugwort/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M) && M.mind) if(M.mind.special_role == SPECIAL_ROLE_WIZARD) - M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/consumable/porktonium name = "Porktonium" @@ -563,6 +572,7 @@ if(prob(8)) M.reagents.add_reagent("radium", 15) M.reagents.add_reagent("cyanide", 10) + return list(0, STATUS_UPDATE_NONE) /datum/reagent/consumable/chicken_soup name = "Chicken soup" @@ -585,7 +595,7 @@ /datum/reagent/consumable/cheese/on_mob_life(mob/living/M) if(prob(3)) M.reagents.add_reagent("cholesterol", rand(1,2)) - ..() + return ..() /datum/reagent/consumable/cheese/reaction_turf(turf/T, volume) if(volume >= 5 && !isspaceturf(T)) @@ -601,9 +611,11 @@ taste_message = "cheese?" /datum/reagent/consumable/fake_cheese/overdose_process(mob/living/M, severity) + var/update_flags = STATUS_UPDATE_NONE if(prob(8)) to_chat(M, "You feel something squirming in your stomach. Your thoughts turn to cheese and you begin to sweat.") - M.adjustToxLoss(rand(1,2)) + update_flags |= M.adjustToxLoss(rand(1,2), FALSE) + return list(0, update_flags) /datum/reagent/consumable/weird_cheese name = "Weird cheese" @@ -617,7 +629,7 @@ /datum/reagent/consumable/weird_cheese/on_mob_life(mob/living/M) if(prob(5)) M.reagents.add_reagent("cholesterol", rand(1,3)) - ..() + return ..() /datum/reagent/consumable/weird_cheese/reaction_turf(turf/T, volume) if(volume >= 5 && !isspaceturf(T)) @@ -634,7 +646,7 @@ /datum/reagent/consumable/beans/on_mob_life(mob/living/M) if(prob(10)) M.emote("fart") - ..() + return ..() /datum/reagent/consumable/bread name = "Bread" @@ -657,7 +669,7 @@ M.reagents.add_reagent("cholesterol", rand(1,3)) if(prob(8)) M.reagents.add_reagent("porktonium", 5) - ..() + return ..() /datum/reagent/consumable/hydrogenated_soybeanoil name = "Partially hydrogenated space-soybean oil" @@ -678,19 +690,21 @@ metabolization_rate = 0.4 else metabolization_rate = 0.2 - ..() + return ..() /datum/reagent/consumable/hydrogenated_soybeanoil/overdose_process(mob/living/M, severity) + var/update_flags = STATUS_UPDATE_NONE if(prob(33)) to_chat(M, "You feel horribly weak.") if(prob(10)) to_chat(M, "You cannot breathe!") - M.adjustOxyLoss(5) + update_flags |= M.adjustOxyLoss(5, FALSE) if(prob(5)) to_chat(M, "You feel a sharp pain in your chest!") - M.adjustOxyLoss(25) - M.Stun(5) - M.Paralyse(10) + update_flags |= M.adjustOxyLoss(25, FALSE) + update_flags |= M.Stun(5, FALSE) + update_flags |= M.Paralyse(10, FALSE) + return list(0, update_flags) /datum/reagent/consumable/meatslurry name = "Meat Slurry" @@ -703,7 +717,7 @@ /datum/reagent/consumable/meatslurry/on_mob_life(mob/living/M) if(prob(4)) M.reagents.add_reagent("cholesterol", rand(1,3)) - ..() + return ..() /datum/reagent/consumable/meatslurry/reaction_turf(turf/T, volume) if(prob(10) && volume >= 5 && !isspaceturf(T)) @@ -742,7 +756,7 @@ else if(prob(6)) to_chat(M, "[pick("You feel ill.","Your stomach churns.","You feel queasy.","You feel sick.")]") M.emote(pick("groan","moan")) - ..() + return ..() /datum/reagent/consumable/pepperoni name = "Pepperoni" @@ -786,8 +800,9 @@ /datum/reagent/questionmark/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == INGEST) - M.Stun(2) - M.Weaken(2) + M.Stun(2, FALSE) + M.Weaken(2, FALSE) + M.update_canmove() to_chat(M, "Ugh! Eating that was a terrible idea!") M.ForceContractDisease(new /datum/disease/food_poisoning(0)) @@ -801,13 +816,14 @@ taste_message = "excellent cuisine" /datum/reagent/msg/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(5)) if(prob(10)) - M.adjustToxLoss(rand(2.4)) + update_flags |= M.adjustToxLoss(rand(2.4), FALSE) if(prob(7)) to_chat(M, "A horrible migraine overpowers you.") - M.Stun(rand(2,5)) - ..() + update_flags |= M.Stun(rand(2,5), FALSE) + return ..() | update_flags /datum/reagent/cholesterol name = "cholesterol" @@ -818,22 +834,23 @@ taste_message = "heart attack" /datum/reagent/cholesterol/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(volume >= 25 && prob(volume*0.15)) to_chat(M, "Your chest feels [pick("weird","uncomfortable","nasty","gross","odd","unusual","warm")]!") - M.adjustToxLoss(rand(1,2)) + update_flags |= M.adjustToxLoss(rand(1,2), FALSE) else if(volume >= 45 && prob(volume*0.08)) to_chat(M, "Your chest [pick("hurts","stings","aches","burns")]!") - M.adjustToxLoss(rand(2,4)) - M.Stun(1) + update_flags |= M.adjustToxLoss(rand(2,4), FALSE) + update_flags |= M.Stun(1, FALSE) else if(volume >= 150 && prob(volume*0.01)) to_chat(M, "Your chest is burning with pain!") - M.Stun(1) - M.Weaken(1) + update_flags |= M.Stun(1, FALSE) + update_flags |= M.Weaken(1, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.undergoing_cardiac_arrest()) H.set_heartattack(TRUE) - ..() + return ..() | update_flags /datum/reagent/fungus name = "Space fungus" @@ -868,7 +885,7 @@ var/spooky_message = pick("You notice something moving out of the corner of your eye, but nothing is there...", "Your eyes twitch, you feel like something you can't see is here...", "You've got the heebie-jeebies.", "You feel uneasy.", "You shudder as if cold...", "You feel something gliding across your back...") if(prob(8)) to_chat(M, "[spooky_message]") - ..() + return ..() /datum/reagent/ectoplasm/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == INGEST) @@ -879,12 +896,12 @@ if(volume >= 10 && !isspaceturf(T)) new /obj/item/reagent_containers/food/snacks/ectoplasm(T) -///Vomit/// - /datum/reagent/consumable/bread/reaction_turf(turf/T, volume) if(volume >= 5 && !isspaceturf(T)) new /obj/item/reagent_containers/food/snacks/breadslice(T) + ///Vomit/// + /datum/reagent/vomit name = "Vomit" id = "vomit" @@ -921,15 +938,16 @@ taste_message = "mold" /datum/reagent/consumable/entpoly/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(current_cycle >= 10) - M.Paralyse(2) + update_flags |= M.Paralyse(2, FALSE) if(prob(20)) - M.LoseBreath(4) - M.adjustBrainLoss(2 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(3 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustStaminaLoss(10 * REAGENTS_EFFECT_MULTIPLIER) - M.EyeBlurry(5) - ..() + update_flags |= M.LoseBreath(4, FALSE) + update_flags |= M.adjustBrainLoss(2 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(3 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustStaminaLoss(10 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.EyeBlurry(5, FALSE) + return ..() | update_flags /datum/reagent/consumable/tinlux name = "Tinea Luxor" @@ -943,7 +961,7 @@ if(!light_activated) M.set_light(2) light_activated = 1 - ..() + return ..() /datum/reagent/consumable/tinlux/on_mob_delete(mob/living/M) M.set_light(0) @@ -957,7 +975,8 @@ taste_message = "sweetness" /datum/reagent/consumable/vitfro/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(80)) - M.adjustBruteLoss(-1 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-1 * REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustBruteLoss(-1 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-1 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags diff --git a/code/modules/reagents/chemistry/reagents/medicine.dm b/code/modules/reagents/chemistry/reagents/medicine.dm index f603d5eb0d1..bc6f8f66317 100644 --- a/code/modules/reagents/chemistry/reagents/medicine.dm +++ b/code/modules/reagents/chemistry/reagents/medicine.dm @@ -20,7 +20,7 @@ var/mob/living/carbon/human/H = M if(H.traumatic_shock < 100) H.shock_stage = 0 - ..() + return ..() /datum/reagent/medicine/sterilizine name = "Sterilizine" @@ -49,17 +49,20 @@ overdose_threshold = 40 /datum/reagent/medicine/synaptizine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) - M.SetSleeping(0) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) + update_flags |= M.SetSleeping(0, FALSE) if(prob(50)) - M.adjustBrainLoss(-1.0) - ..() + update_flags |= M.adjustBrainLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/medicine/synaptizine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 1) M.visible_message("[M] suddenly and violently vomits!") @@ -67,7 +70,7 @@ else if(effect <= 3) M.emote(pick("groan","moan")) if(effect <= 8) - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) else if(severity == 2) if(effect <= 2) M.visible_message("[M] suddenly and violently vomits!") @@ -75,9 +78,10 @@ else if(effect <= 5) M.visible_message("[M] staggers and drools, [M.p_their()] eyes bloodshot!") M.Dizzy(8) - M.Weaken(4) + update_flags |= M.Weaken(4, FALSE) if(effect <= 15) - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) + return list(effect, update_flags) /datum/reagent/medicine/mitocholide name = "Mitocholide" @@ -93,7 +97,7 @@ //Mitocholide is hard enough to get, it's probably fair to make this all internal organs for(var/obj/item/organ/internal/I in H.internal_organs) I.heal_internal_damage(0.4) - ..() + return ..() /datum/reagent/medicine/mitocholide/reaction_obj(obj/O, volume) if(istype(O, /obj/item/organ)) @@ -110,18 +114,19 @@ heart_rate_decrease = 1 /datum/reagent/medicine/cryoxadone/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(M.bodytemperature < 265) - M.adjustCloneLoss(-4) - M.adjustOxyLoss(-10) - M.adjustToxLoss(-3) - M.adjustBruteLoss(-12) - M.adjustFireLoss(-12) + update_flags |= M.adjustCloneLoss(-4, FALSE) + update_flags |= M.adjustOxyLoss(-10, FALSE) + update_flags |= M.adjustToxLoss(-3, FALSE) + update_flags |= M.adjustBruteLoss(-12, FALSE) + update_flags |= M.adjustFireLoss(-12, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head = H.get_organ("head") if(head) head.disfigured = FALSE - ..() + return ..() | update_flags /datum/reagent/medicine/rezadone name = "Rezadone" @@ -132,21 +137,24 @@ overdose_threshold = 30 /datum/reagent/medicine/rezadone/on_mob_life(mob/living/M) - M.setCloneLoss(0) //Rezadone is almost never used in favor of cryoxadone. Hopefully this will change that. - M.adjustCloneLoss(-1) //What? We just set cloneloss to 0. Why? Simple; this is so external organs properly unmutate. - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.setCloneLoss(0, FALSE) //Rezadone is almost never used in favor of cryoxadone. Hopefully this will change that. + update_flags |= M.adjustCloneLoss(-1, FALSE) //What? We just set cloneloss to 0. Why? Simple; this is so external organs properly unmutate. // why don't you fix the code instead + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/external/head/head = H.get_organ("head") if(head) head.disfigured = FALSE - ..() + return ..() | update_flags /datum/reagent/medicine/rezadone/overdose_process(mob/living/M, severity) - M.adjustToxLoss(1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) M.Dizzy(5) M.Jitter(5) + return list(0, update_flags) /datum/reagent/medicine/spaceacillin name = "Spaceacillin" @@ -165,8 +173,9 @@ metabolization_rate = 3 /datum/reagent/medicine/silver_sulfadiazine/on_mob_life(mob/living/M) - M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/silver_sulfadiazine/reaction_mob(mob/living/M, method=TOUCH, volume, show_message = 1) if(iscarbon(M)) @@ -189,8 +198,9 @@ metabolization_rate = 3 /datum/reagent/medicine/styptic_powder/on_mob_life(mob/living/M) - M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/styptic_powder/reaction_mob(mob/living/M, method=TOUCH, volume, show_message = 1) if(iscarbon(M)) @@ -216,15 +226,16 @@ taste_message = "salt" /datum/reagent/medicine/salglu_solution/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(33)) - M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(ishuman(M) && prob(33)) var/mob/living/carbon/human/H = M if(!(NO_BLOOD in H.dna.species.species_traits))//do not restore blood on things with no blood by nature. if(H.blood_volume < BLOOD_VOLUME_NORMAL) H.blood_volume += 1 - ..() + return ..() | update_flags /datum/reagent/medicine/synthflesh name = "Synthflesh" @@ -255,12 +266,13 @@ color = "#000000" /datum/reagent/medicine/charcoal/on_mob_life(mob/living/M) - M.adjustToxLoss(-1.5*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(-1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(50)) for(var/datum/reagent/R in M.reagents.reagent_list) if(R != src) M.reagents.remove_reagent(R.id,1) - ..() + return ..() | update_flags /datum/reagent/medicine/omnizine name = "Omnizine" @@ -273,30 +285,33 @@ addiction_chance = 5 /datum/reagent/medicine/omnizine/on_mob_life(mob/living/M) - M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(50)) M.AdjustLoseBreath(-1) - ..() + return ..() | update_flags /datum/reagent/medicine/omnizine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) //lesser - M.stuttering += 1 + M.AdjustStuttering(1) if(effect <= 1) M.visible_message("[M] suddenly cluches [M.p_their()] gut!") M.emote("scream") - M.Stun(4) - M.Weaken(4) + update_flags |= M.Stun(4, FALSE) + update_flags |= M.Weaken(4, FALSE) else if(effect <= 3) M.visible_message("[M] completely spaces out for a moment.") M.AdjustConfused(15) else if(effect <= 5) M.visible_message("[M] stumbles and staggers.") M.Dizzy(5) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) else if(effect <= 7) M.visible_message("[M] shakes uncontrollably.") M.Jitter(30) @@ -304,16 +319,17 @@ if(effect <= 2) M.visible_message("[M] suddenly cluches [M.p_their()] gut!") M.emote("scream") - M.Stun(7) - M.Weaken(7) + update_flags |= M.Stun(7, FALSE) + update_flags |= M.Weaken(7, FALSE) else if(effect <= 5) M.visible_message("[M] jerks bolt upright, then collapses!") - M.Paralyse(5) - M.Weaken(4) + update_flags |= M.Paralyse(5, FALSE) + update_flags |= M.Weaken(4, FALSE) else if(effect <= 8) M.visible_message("[M] stumbles and staggers.") M.Dizzy(5) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) + return list(effect, update_flags) /datum/reagent/medicine/calomel name = "Calomel" @@ -324,14 +340,15 @@ metabolization_rate = 0.8 /datum/reagent/medicine/calomel/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE for(var/datum/reagent/R in M.reagents.reagent_list) if(R != src) M.reagents.remove_reagent(R.id,5) if(M.health > 20) - M.adjustToxLoss(5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(6)) M.fakevomit() - ..() + return ..() | update_flags /datum/reagent/medicine/potass_iodide name = "Potassium Iodide" @@ -343,7 +360,7 @@ /datum/reagent/medicine/potass_iodide/on_mob_life(mob/living/M) if(prob(80)) M.radiation = max(0, M.radiation-1) - ..() + return ..() /datum/reagent/medicine/pen_acid name = "Pentetic Acid" @@ -353,16 +370,17 @@ color = "#C8A5DC" /datum/reagent/medicine/pen_acid/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE for(var/datum/reagent/R in M.reagents.reagent_list) if(R != src) M.reagents.remove_reagent(R.id,4) M.radiation = max(0, M.radiation-7) if(prob(75)) - M.adjustToxLoss(-4*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(-4*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(33)) - M.adjustBruteLoss(1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustBruteLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/sal_acid name = "Salicylic Acid" @@ -375,13 +393,14 @@ overdose_threshold = 25 /datum/reagent/medicine/sal_acid/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(55)) - M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M if(H.traumatic_shock < 100) H.shock_stage = 0 - ..() + return ..() | update_flags /datum/reagent/medicine/salbutamol name = "Salbutamol" @@ -392,9 +411,10 @@ metabolization_rate = 0.2 /datum/reagent/medicine/salbutamol/on_mob_life(mob/living/M) - M.adjustOxyLoss(-6*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustOxyLoss(-6*REAGENTS_EFFECT_MULTIPLIER, FALSE) M.AdjustLoseBreath(-4) - ..() + return ..() | update_flags /datum/reagent/medicine/perfluorodecalin name = "Perfluorodecalin" @@ -406,14 +426,15 @@ addiction_chance = 20 /datum/reagent/medicine/perfluorodecalin/on_mob_life(mob/living/carbon/human/M) - M.adjustOxyLoss(-25*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustOxyLoss(-25*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(volume >= 4) M.LoseBreath(6) M.Silence(6) if(prob(33)) - M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/ephedrine name = "Ephedrine" @@ -426,22 +447,25 @@ addiction_chance = 25 /datum/reagent/medicine/ephedrine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) - M.adjustStaminaLoss(-1*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) + update_flags |= M.adjustStaminaLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) M.AdjustLoseBreath(-1, bound_lower = 5) if(M.oxyloss > 75) - M.adjustOxyLoss(-1) + update_flags |= M.adjustOxyLoss(-1, FALSE) if(M.health < 0 || M.health > 0 && prob(33)) - M.adjustToxLoss(-1) - M.adjustBruteLoss(-1) - M.adjustFireLoss(-1) - ..() + update_flags |= M.adjustToxLoss(-1, FALSE) + update_flags |= M.adjustBruteLoss(-1, FALSE) + update_flags |= M.adjustFireLoss(-1, FALSE) + return ..() | update_flags /datum/reagent/medicine/ephedrine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 1) M.visible_message("[M] suddenly and violently vomits!") @@ -457,9 +481,10 @@ else if(effect <= 5) M.visible_message("[M.name] staggers and drools, [M.p_their()] eyes bloodshot!") M.Dizzy(2) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) if(effect <= 15) M.emote("collapse") + return list(effect, update_flags) /datum/reagent/medicine/diphenhydramine name = "Diphenhydramine" @@ -476,10 +501,10 @@ if(prob(7)) M.emote("yawn") if(prob(3)) - M.Stun(2) + M.AdjustDrowsy(1) M.visible_message("[M] looks a bit dazed.") - ..() + return ..() /datum/reagent/medicine/morphine name = "Morphine" @@ -516,19 +541,20 @@ color = "#C8A5DC" /datum/reagent/medicine/oculine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(80)) if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/internal/eyes/E = H.get_int_organ(/obj/item/organ/internal/eyes) if(istype(E)) E.heal_internal_damage(1) - M.AdjustEyeBlurry(-1) - M.AdjustEarDamage(-1) + update_flags |= M.AdjustEyeBlurry(-1, FALSE) + update_flags |= M.AdjustEarDamage(-1, FALSE) if(prob(50)) - M.CureNearsighted() + update_flags |= M.CureNearsighted(FALSE) if(prob(30)) - M.CureBlind() - M.SetEyeBlind(0) + update_flags |= M.CureBlind(FALSE) + update_flags |= M.SetEyeBlind(0, FALSE) if(M.ear_damage <= 25) if(prob(30)) M.SetEarDeaf(0) @@ -544,21 +570,22 @@ overdose_threshold = 25 /datum/reagent/medicine/atropine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDizzy(1) M.Confused(5) if(prob(4)) M.emote("collapse") M.AdjustLoseBreath(-5, bound_lower = 5) if(M.oxyloss > 65) - M.adjustOxyLoss(-10*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustOxyLoss(-10*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(M.health < -25) - M.adjustToxLoss(-1) - M.adjustBruteLoss(-3*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-3*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(-1, FALSE) + update_flags |= M.adjustBruteLoss(-3*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-3*REAGENTS_EFFECT_MULTIPLIER, FALSE) else if(M.health > -60) - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) M.reagents.remove_reagent("sarin", 20) - ..() + return ..() | update_flags /datum/reagent/medicine/epinephrine name = "Epinephrine" @@ -570,29 +597,32 @@ overdose_threshold = 20 /datum/reagent/medicine/epinephrine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) if(prob(20)) - M.AdjustParalysis(-1) + update_flags |= M.AdjustParalysis(-1, FALSE) if(prob(20)) - M.AdjustStunned(-1) + update_flags |= M.AdjustStunned(-1, FALSE) if(prob(20)) - M.AdjustWeakened(-1) + update_flags |= M.AdjustWeakened(-1, FALSE) if(prob(5)) - M.SetSleeping(0) + update_flags |= M.SetSleeping(0, FALSE) if(prob(5)) - M.adjustBrainLoss(-1) + update_flags |= M.adjustBrainLoss(-1, FALSE) holder.remove_reagent("histamine", 15) M.AdjustLoseBreath(-1, bound_lower = 3) if(M.oxyloss > 35) - M.adjustOxyLoss(-10*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustOxyLoss(-10*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(M.health < -10 && M.health > -65) - M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/epinephrine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 1) M.visible_message("[M] suddenly and violently vomits!") @@ -608,7 +638,7 @@ else if(effect <= 5) M.visible_message("[M] staggers and drools, [M.p_their()] eyes bloodshot!") M.Dizzy(2) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) if(effect <= 15) M.emote("collapse") @@ -621,10 +651,11 @@ metabolization_rate = 0.2 /datum/reagent/medicine/strange_reagent/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(10)) - M.adjustBruteLoss(2*REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustBruteLoss(2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/strange_reagent/reaction_mob(mob/living/M, method=TOUCH, volume) if(volume < 1) @@ -685,8 +716,9 @@ color = "#D1D1F1" /datum/reagent/medicine/mannitol/on_mob_life(mob/living/M) - M.adjustBrainLoss(-3) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBrainLoss(-3, FALSE) + return ..() | update_flags /datum/reagent/medicine/mutadone name = "Mutadone" @@ -722,12 +754,13 @@ color = "#009CA8" /datum/reagent/medicine/antihol/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.SetSlur(0) M.AdjustDrunk(-4) M.reagents.remove_all_type(/datum/reagent/consumable/ethanol, 8, 0, 1) if(M.toxloss <= 25) - M.adjustToxLoss(-2.0) - ..() + update_flags |= M.adjustToxLoss(-2.0, FALSE) + return ..() | update_flags /datum/reagent/medicine/stimulants name = "Stimulants" @@ -737,26 +770,28 @@ can_synth = FALSE /datum/reagent/medicine/stimulants/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(volume > 5) - M.adjustOxyLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-10*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-10*REAGENTS_EFFECT_MULTIPLIER) - M.setStaminaLoss(0) + update_flags |= M.adjustOxyLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-10*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-10*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.setStaminaLoss(0, FALSE) M.SetSlowed(0) M.AdjustDizzy(-10) M.AdjustDrowsy(-10) M.SetConfused(0) - M.SetSleeping(0) + update_flags |= M.SetSleeping(0, FALSE) var/status = CANSTUN | CANWEAKEN | CANPARALYSE M.status_flags &= ~status else M.status_flags |= CANSTUN | CANWEAKEN | CANPARALYSE - M.adjustToxLoss(2) - M.adjustBruteLoss(1) + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBruteLoss(1, FALSE) if(prob(10)) - M.Stun(3) - ..() + update_flags |= M.Stun(3, FALSE) + + return ..() | update_flags /datum/reagent/medicine/stimulants/on_mob_delete(mob/living/M) M.status_flags |= CANSTUN | CANWEAKEN | CANPARALYSE @@ -772,27 +807,30 @@ can_synth = FALSE /datum/reagent/medicine/stimulative_agent/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.status_flags |= GOTTAGOFAST if(M.health < 50 && M.health > 0) - M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER) - M.AdjustParalysis(-3) - M.AdjustStunned(-3) - M.AdjustWeakened(-3) - M.adjustStaminaLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.AdjustParalysis(-3, FALSE) + update_flags |= M.AdjustStunned(-3, FALSE) + update_flags |= M.AdjustWeakened(-3, FALSE) + update_flags |= M.adjustStaminaLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/stimulative_agent/on_mob_delete(mob/living/M) M.status_flags &= ~GOTTAGOFAST ..() /datum/reagent/medicine/stimulative_agent/overdose_process(mob/living/M, severity) + var/update_flags = STATUS_UPDATE_NONE if(prob(33)) - M.adjustStaminaLoss(2.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustStaminaLoss(2.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) M.AdjustLoseBreath(1) + return list(0, update_flags) /datum/reagent/medicine/insulin name = "Insulin" @@ -835,6 +873,7 @@ color = "#FFDCFF" /datum/reagent/medicine/haloperidol/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.reagents.remove_reagent("crank", 5) M.reagents.remove_reagent("methamphetamine", 5) M.reagents.remove_reagent("space_drugs", 5) @@ -845,7 +884,7 @@ M.reagents.remove_reagent("bath_salts", 5) M.reagents.remove_reagent("lsd", 5) M.reagents.remove_reagent("thc", 5) - M.AdjustDruggy(-5) + update_flags |= M.AdjustDruggy(-5, FALSE) M.AdjustHallucinate(-5) M.AdjustJitter(-5) if(prob(50)) @@ -853,8 +892,8 @@ if(prob(10)) M.emote("drool") if(prob(20)) - M.adjustBrainLoss(1) - ..() + update_flags |= M.adjustBrainLoss(1, FALSE) + return ..() | update_flags /datum/reagent/medicine/ether name = "Ether" @@ -886,13 +925,14 @@ can_synth = FALSE /datum/reagent/medicine/syndicate_nanites/on_mob_life(mob/living/M) - M.adjustBruteLoss(-5*REAGENTS_EFFECT_MULTIPLIER) //A ton of healing - this is a 50 telecrystal investment. - M.adjustFireLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(-15*REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBrainLoss(-15*REAGENTS_EFFECT_MULTIPLIER) - M.adjustCloneLoss(-3*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) //A ton of healing - this is a 50 telecrystal investment. + update_flags |= M.adjustFireLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(-15*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBrainLoss(-15*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustCloneLoss(-3*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/omnizine_diluted name = "Diluted Omnizine" @@ -904,17 +944,20 @@ metabolization_rate = 0.1 /datum/reagent/medicine/omnizine_diluted/on_mob_life(mob/living/M) - M.adjustToxLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/omnizine_diluted/overdose_process(mob/living/M, severity) - M.adjustToxLoss(1.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(1.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustBruteLoss(1.5*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(1.5*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBruteLoss(1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return list(0, update_flags) //virus-specific symptom reagents @@ -925,6 +968,7 @@ color = "#EC536D" // rgb: 236, 83, 109 /datum/reagent/medicine/synaphydramine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustDrowsy(-5) if(holder.has_reagent("lsd")) holder.remove_reagent("lsd", 5) @@ -932,8 +976,8 @@ holder.remove_reagent("histamine", 5) M.AdjustHallucinate(-10) if(prob(30)) - M.adjustToxLoss(1) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags ////////////////////////////// // Synth-Meds // @@ -949,10 +993,11 @@ process_flags = SYNTHETIC /datum/reagent/medicine/degreaser/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(50)) //Same effects as coffee, to help purge ill effects like paralysis - M.AdjustParalysis(-1) - M.AdjustStunned(-1) - M.AdjustWeakened(-1) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-1, FALSE) + update_flags |= M.AdjustWeakened(-1, FALSE) M.AdjustConfused(-5) for(var/datum/reagent/R in M.reagents.reagent_list) if(R != src) @@ -961,7 +1006,7 @@ M.reagents.remove_reagent(R.id, 5) else M.reagents.remove_reagent(R.id,1) - ..() + return ..() | update_flags /datum/reagent/medicine/degreaser/reaction_turf(turf/simulated/T, volume) if(volume >= 1 && istype(T)) @@ -978,8 +1023,9 @@ process_flags = SYNTHETIC /datum/reagent/medicine/liquid_solder/on_mob_life(mob/living/M) - M.adjustBrainLoss(-3) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBrainLoss(-3, FALSE) + return ..() | update_flags @@ -993,11 +1039,14 @@ overdose_threshold = 30 /datum/reagent/medicine/bicaridine/on_mob_life(mob/living/M) - M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/bicaridine/overdose_process(mob/living/M) - M.adjustBruteLoss(4*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(4*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return list(0, update_flags) /datum/reagent/medicine/kelotane name = "Kelotane" @@ -1008,11 +1057,14 @@ overdose_threshold = 30 /datum/reagent/medicine/kelotane/on_mob_life(mob/living/M) - M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(-2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/kelotane/overdose_process(mob/living/M) - M.adjustFireLoss(4*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(4*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/medicine/earthsblood //Created by ambrosia gaia plants @@ -1023,20 +1075,23 @@ overdose_threshold = 25 /datum/reagent/medicine/earthsblood/on_mob_life(mob/living/M) - M.adjustBruteLoss(-3 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(-3 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustOxyLoss(-15 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustToxLoss(-3 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustBrainLoss(2 * REAGENTS_EFFECT_MULTIPLIER) //This does, after all, come from ambrosia, and the most powerful ambrosia in existence, at that! - M.adjustCloneLoss(-1 * REAGENTS_EFFECT_MULTIPLIER) - M.adjustStaminaLoss(-30 * REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(-3 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(-3 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustOxyLoss(-15 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustToxLoss(-3 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustBrainLoss(2 * REAGENTS_EFFECT_MULTIPLIER, FALSE) //This does, after all, come from ambrosia, and the most powerful ambrosia in existence, at that! + update_flags |= M.adjustCloneLoss(-1 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustStaminaLoss(-30 * REAGENTS_EFFECT_MULTIPLIER, FALSE) M.SetJitter(min(max(0, M.jitteriness + 3), 30)) - M.SetDruggy(min(max(0, M.druggy + 10), 15)) //See above - ..() + update_flags |= M.SetDruggy(min(max(0, M.druggy + 10), 15), FALSE) //See above + return ..() | update_flags /datum/reagent/medicine/earthsblood/overdose_process(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.SetHallucinate(min(max(0, M.hallucination + 10), 50)) - M.adjustToxLoss(5 * REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(5 * REAGENTS_EFFECT_MULTIPLIER, FALSE) + return list(0, update_flags) /datum/reagent/medicine/corazone name = "Corazone" @@ -1055,6 +1110,7 @@ can_synth = FALSE /datum/reagent/medicine/nanocalcium/on_mob_life(mob/living/carbon/human/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 19) M.AdjustJitter(4) @@ -1063,15 +1119,15 @@ if(20 to 43) //If they have stimulants or stimulant drugs then just apply toxin damage instead. if(M.reagents.has_reagent("methamphetamine") || M.reagents.has_reagent("crank") || M.reagents.has_reagent("bath_salts") || M.reagents.has_reagent("stimulative_agent") || M.reagents.has_reagent("stimulants")) - M.adjustToxLoss(10) + update_flags |= M.adjustToxLoss(10, FALSE) else //apply debilitating effects if(prob(75)) M.AdjustConfused(5) else - M.AdjustWeakened(5) + update_flags |= M.AdjustWeakened(5, FALSE) if(44) to_chat(M, "Your body goes rigid, you cannot move at all!") - M.AdjustWeakened(15) + update_flags |= M.AdjustWeakened(15, FALSE) if(45 to INFINITY) // Start fixing bones | If they have stimulants or stimulant drugs in their system then the nanites won't work. if(M.reagents.has_reagent("methamphetamine") || M.reagents.has_reagent("crank") || M.reagents.has_reagent("bath_salts") || M.reagents.has_reagent("stimulative_agent") || M.reagents.has_reagent("stimulants")) return ..() @@ -1082,4 +1138,4 @@ to_chat(M, "You feel a burning sensation in your [E.name] as it straightens involuntarily!") E.rejuvenate() //Repair it completely. break - ..() + return ..() | update_flags diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index fdddea44bd2..c86a839c4e2 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -250,8 +250,9 @@ taste_message = null /datum/reagent/acetone/on_mob_life(mob/living/M) - M.adjustToxLoss(1.5) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1.5, FALSE) + return ..() | update_flags /datum/reagent/saltpetre name = "Saltpetre" @@ -362,20 +363,21 @@ taste_message = "mexican cuisine" /datum/reagent/fartonium/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(66)) M.emote("fart") if(holder.has_reagent("simethicone")) if(prob(25)) to_chat(M, "[pick("Oh god, something doesn't feel right!", "IT HURTS!", "FUCK!", "Something is seriously wrong!", "THE PAIN!", "You feel like you're gonna die!")]") - M.adjustBruteLoss(1) + update_flags |= M.adjustBruteLoss(1, FALSE) if(prob(10)) M.custom_emote(1,"strains, but nothing happens.") - M.adjustBruteLoss(2) + update_flags |= M.adjustBruteLoss(2, FALSE) if(prob(5)) M.emote("scream") - M.adjustBruteLoss(4) - ..() + update_flags |= M.adjustBruteLoss(4, FALSE) + return ..() | update_flags /datum/reagent/hugs name = "Pure hugs" @@ -412,7 +414,7 @@ M.visible_message("[M] gives [C] a [pick("hug","warm embrace")].") playsound(get_turf(M), 'sound/weapons/thudswoosh.ogg', 50, 1, -1) break - ..() + return ..() /datum/reagent/love/on_mob_delete(mob/living/M) M.can_change_intents = 1 @@ -432,7 +434,7 @@ /datum/reagent/royal_bee_jelly/on_mob_life(mob/living/M) if(prob(2)) M.say(pick("Bzzz...","BZZ BZZ","Bzzzzzzzzzzz...")) - ..() + return ..() /datum/reagent/growthserum name = "Growth serum" @@ -459,7 +461,7 @@ H.resize = newsize/current_size current_size = newsize H.update_transform() - ..() + return ..() /datum/reagent/growthserum/on_mob_delete(mob/living/M) M.resize = 1/current_size @@ -493,9 +495,10 @@ taste_message = "puke" /datum/reagent/plantnutriment/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(tox_prob)) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/plantnutriment/eznutriment name = "E-Z-Nutrient" diff --git a/code/modules/reagents/chemistry/reagents/paradise_pop.dm b/code/modules/reagents/chemistry/reagents/paradise_pop.dm index edf633bcacc..08f01bdd381 100644 --- a/code/modules/reagents/chemistry/reagents/paradise_pop.dm +++ b/code/modules/reagents/chemistry/reagents/paradise_pop.dm @@ -43,23 +43,24 @@ taste_message = "a permaban" /datum/reagent/consumable/drink/berry_banned/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(10)) var/heal_type = rand(0, 5) //still prefer the string version switch(heal_type) if(0) - M.adjustBruteLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustBruteLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(1) - M.adjustFireLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustFireLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(2) - M.adjustToxLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(3) - M.adjustOxyLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustOxyLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(4) - M.adjustCloneLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustCloneLoss(-0.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(5) - M.adjustBrainLoss(-1*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustBrainLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE) to_chat(M, "You feel slightly rejuvinated!") - ..() + return ..() | update_flags //Berry Banned 2: This one is tasty and toxic. Deals toxin damage and MAYBE plays the "BWOINK!" sound if it kills someone? /datum/reagent/consumable/drink/berry_banned2 @@ -71,11 +72,12 @@ taste_message = "a permaban" /datum/reagent/consumable/drink/berry_banned2/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(50)) - M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER) //double strength of poison berry juice alone, because it's concentrated (this is equal to the damage of normal toxin, less often) + update_flags |= M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER, FALSE) //double strength of poison berry juice alone, because it's concentrated (this is equal to the damage of normal toxin, less often) if(prob(10)) to_chat(M, "You feel slightly rejuvinated!") //meta this! - ..() + return ..() | update_flags /datum/reagent/consumable/drink/berry_banned2/on_mob_death(mob/living/M) M << sound('sound/effects/adminhelp.ogg',0,1,0,25) @@ -103,7 +105,7 @@ "THIS DOOR WAS SHOCKED WHEN I GOT HERE", "ANIMALS ARE NOT CREW") M.say(pick(tider_talk)) - ..() + return ..() //Grape Granade: causes the drinker to sometimes burp, has a low chance to cause a goonchem vortex that pushes things within a very small radius (1-2 tiles) away from the drinker /datum/reagent/consumable/drink/grape_granade @@ -122,7 +124,7 @@ to_chat(M, "You feel ready to burst! Oh wait, just a burp...") else if(prob(25)) M.emote("burp") - ..() + return ..() //Meteor Malt: Sometimes causes screen shakes for the drinker like a meteor impact, low chance to add 1-5 units of a random mineral reagent to the drinker's blood (iron, copper, silver, gold, uranium, carbon, etc) /datum/reagent/consumable/drink/meteor_malt @@ -141,4 +143,4 @@ var/amount = rand(1, 5) var/mineral = pick("copper", "iron", "gold", "carbon", "silver", "aluminum", "silicon", "sodiumchloride", "plasma") M.reagents.add_reagent(mineral, amount) - ..() + return ..() diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm index f2a5e8b9e24..bc47e709823 100644 --- a/code/modules/reagents/chemistry/reagents/pyrotechnic.dm +++ b/code/modules/reagents/chemistry/reagents/pyrotechnic.dm @@ -24,13 +24,14 @@ taste_message = "corporate assets going to waste" /datum/reagent/plasma/on_mob_life(mob/living/M) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(holder.has_reagent("epinephrine")) holder.remove_reagent("epinephrine", 2) if(iscarbon(M)) var/mob/living/carbon/C = M C.adjustPlasma(10) - ..() + return ..() | update_flags /datum/reagent/plasma/reaction_mob(mob/living/M, method=TOUCH, volume)//Splashing people with plasma is stronger than fuel! if(method == TOUCH) @@ -80,10 +81,11 @@ taste_message = null /datum/reagent/clf3/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.adjust_fire_stacks(2) var/burndmg = max(0.3*M.fire_stacks, 0.3) - M.adjustFireLoss(burndmg) - ..() + update_flags |= M.adjustFireLoss(burndmg, FALSE) + return ..() | update_flags /datum/reagent/clf3/reaction_turf(turf/simulated/T, volume) if(prob(1) && istype(T, /turf/simulated/floor/plating)) @@ -167,10 +169,11 @@ process_flags = ORGANIC | SYNTHETIC /datum/reagent/phlogiston/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.adjust_fire_stacks(1) var/burndmg = max(0.3*M.fire_stacks, 0.3) - M.adjustFireLoss(burndmg) - ..() + update_flags |= M.adjustFireLoss(burndmg, FALSE) + return ..() | update_flags /datum/reagent/phlogiston/reaction_mob(mob/living/M, method=TOUCH, volume) M.adjust_fire_stacks(1) @@ -187,7 +190,7 @@ /datum/reagent/napalm/on_mob_life(mob/living/M) M.adjust_fire_stacks(1) - ..() + return ..() /datum/reagent/napalm/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == TOUCH) @@ -204,7 +207,7 @@ if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 1) M.bodytemperature -= 30 - ..() + return ..() /datum/reagent/cryostylane/on_tick() if(holder.has_reagent("oxygen")) @@ -229,7 +232,7 @@ if(M.reagents.has_reagent("oxygen")) M.reagents.remove_reagent("oxygen", 1) M.bodytemperature += 30 - ..() + return ..() /datum/reagent/pyrosium/on_tick() if(holder.has_reagent("oxygen")) @@ -276,11 +279,12 @@ taste_message = "corporate assets going to waste" /datum/reagent/plasma_dust/on_mob_life(mob/living/M) - M.adjustToxLoss(3) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(3, FALSE) if(iscarbon(M)) var/mob/living/carbon/C = M C.adjustPlasma(20) - ..() + return ..() | update_flags /datum/reagent/plasma_dust/reaction_mob(mob/living/M, method=TOUCH, volume)//Splashing people with plasma dust is stronger than fuel! if(method == TOUCH) diff --git a/code/modules/reagents/chemistry/reagents/toxins.dm b/code/modules/reagents/chemistry/reagents/toxins.dm index a3fc113339e..d6813ee6f61 100644 --- a/code/modules/reagents/chemistry/reagents/toxins.dm +++ b/code/modules/reagents/chemistry/reagents/toxins.dm @@ -6,8 +6,9 @@ color = "#CF3600" // rgb: 207, 54, 0 /datum/reagent/toxin/on_mob_life(mob/living/M) - M.adjustToxLoss(2) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(2, FALSE) + return ..() | update_flags /datum/reagent/spider_venom name = "Spider venom" @@ -17,8 +18,9 @@ color = "#CF3600" // rgb: 207, 54, 0 /datum/reagent/spider_venom/on_mob_life(mob/living/M) - M.adjustToxLoss(1.5) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1.5, FALSE) + return ..() | update_flags /datum/reagent/minttoxin name = "Mint Toxin" @@ -31,7 +33,7 @@ /datum/reagent/minttoxin/on_mob_life(mob/living/M) if(FAT in M.mutations) M.gib() - ..() + return ..() /datum/reagent/slimejelly name = "Slime Jelly" @@ -42,12 +44,13 @@ taste_message = "slimes" /datum/reagent/slimejelly/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(10)) to_chat(M, "Your insides are burning!") - M.adjustToxLoss(rand(20,60)*REAGENTS_EFFECT_MULTIPLIER) + update_flags |= M.adjustToxLoss(rand(20,60)*REAGENTS_EFFECT_MULTIPLIER, FALSE) else if(prob(40)) - M.adjustBruteLoss(-5*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.adjustBruteLoss(-5*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/slimetoxin name = "Mutation Toxin" @@ -67,7 +70,7 @@ to_chat(M, "Your body reacts violently to light. However, it naturally heals in darkness.") to_chat(M, "Aside from your new traits, you are mentally unchanged and retain your prior obligations.") human.set_species(/datum/species/shadow) - ..() + return ..() /datum/reagent/aslimetoxin name = "Advanced Mutation Toxin" @@ -93,9 +96,10 @@ taste_message = "metal" /datum/reagent/mercury/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(70)) M.adjustBrainLoss(1) - ..() + return ..() | update_flags /datum/reagent/chlorine name = "Chlorine" @@ -108,8 +112,9 @@ taste_message = "fire" /datum/reagent/chlorine/on_mob_life(mob/living/M) - M.adjustFireLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(1, FALSE) + return ..() | update_flags /datum/reagent/fluorine name = "Fluorine" @@ -122,9 +127,10 @@ taste_message = "spicy freshness" /datum/reagent/fluorine/on_mob_life(mob/living/M) - M.adjustFireLoss(1) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(1, FALSE) + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/radium name = "Radium" @@ -137,7 +143,7 @@ /datum/reagent/radium/on_mob_life(mob/living/M) if(M.radiation < 80) M.apply_effect(4, IRRADIATE, negate_armor = 1) - ..() + return ..() /datum/reagent/radium/reaction_turf(turf/T, volume) if(volume >= 3 && !isspaceturf(T)) @@ -167,7 +173,7 @@ M.apply_effect(2*REAGENTS_EFFECT_MULTIPLIER, IRRADIATE, negate_armor = 1) if(prob(4)) randmutb(M) - ..() + return ..() /datum/reagent/uranium @@ -180,7 +186,7 @@ /datum/reagent/uranium/on_mob_life(mob/living/M) M.apply_effect(2, IRRADIATE, negate_armor = 1) - ..() + return ..() /datum/reagent/uranium/reaction_turf(turf/T, volume) if(volume >= 3 && !isspaceturf(T)) @@ -196,8 +202,9 @@ metabolization_rate = 0.2 /datum/reagent/lexorin/on_mob_life(mob/living/M) - M.adjustToxLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/sacid @@ -210,8 +217,9 @@ taste_message = "ACID" /datum/reagent/sacid/on_mob_life(mob/living/M) - M.adjustFireLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustFireLoss(1, FALSE) + return ..() | update_flags /datum/reagent/sacid/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == TOUCH) @@ -282,8 +290,9 @@ color = "#003333" // rgb: 0, 51, 51 /datum/reagent/carpotoxin/on_mob_life(mob/living/M) - M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(2*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/staminatoxin name = "Tirizene" @@ -294,9 +303,10 @@ data = 13 /datum/reagent/staminatoxin/on_mob_life(mob/living/M) - M.adjustStaminaLoss(REAGENTS_EFFECT_MULTIPLIER * data) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustStaminaLoss(REAGENTS_EFFECT_MULTIPLIER * data, FALSE) data = max(data - 1, 3) - ..() + return ..() | update_flags /datum/reagent/spore @@ -306,10 +316,11 @@ color = "#9ACD32" /datum/reagent/spores/on_mob_life(mob/living/M) - M.adjustToxLoss(1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) M.damageoverlaytemp = 60 - M.EyeBlurry(3) - ..() + update_flags |= M.EyeBlurry(3) + return ..() | update_flags /datum/reagent/beer2 //disguised as normal beer for use by emagged service borgs name = "Beer" @@ -323,13 +334,14 @@ taste_message = "beer" /datum/reagent/beer2/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 50) - M.Sleeping(2) + update_flags |= M.Sleeping(2, FALSE) if(51 to INFINITY) - M.Sleeping(2) - M.adjustToxLoss((current_cycle - 50)*REAGENTS_EFFECT_MULTIPLIER) - ..() + update_flags |= M.Sleeping(2, FALSE) + update_flags |= M.adjustToxLoss((current_cycle - 50)*REAGENTS_EFFECT_MULTIPLIER, FALSE) + return ..() | update_flags /datum/reagent/polonium name = "Polonium" @@ -344,7 +356,7 @@ /datum/reagent/polonium/on_mob_life(mob/living/M) M.apply_effect(8, IRRADIATE, negate_armor = 1) - ..() + return ..() /datum/reagent/histamine name = "Histamine" @@ -365,60 +377,64 @@ M.emote("drool") /datum/reagent/histamine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(20)) M.emote(pick("twitch", "grumble", "sneeze", "cough")) if(prob(10)) to_chat(M, "Your eyes itch.") M.emote(pick("blink", "sneeze")) - M.AdjustEyeBlurry(3) + update_flags |= M.AdjustEyeBlurry(3, FALSE) if(prob(10)) M.visible_message("[M] scratches at an itch.") - M.adjustBruteLoss(1) + update_flags |= M.adjustBruteLoss(1, FALSE) M.emote("grumble") if(prob(5)) to_chat(M, "You're getting a rash!") - M.adjustBruteLoss(2) - ..() + update_flags |= M.adjustBruteLoss(2, FALSE) + return ..() | update_flags /datum/reagent/histamine/overdose_process(mob/living/M, severity) - var/effect = ..() + var/list/overdose_info = ..() + var/effect = overdose_info[REAGENT_OVERDOSE_EFFECT] + var/update_flags = overdose_info[REAGENT_OVERDOSE_FLAGS] if(severity == 1) if(effect <= 2) to_chat(M, "You feel mucus running down the back of your throat.") - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) M.Jitter(4) M.emote(pick("sneeze", "cough")) else if(effect <= 4) - M.stuttering += rand(0,5) + M.AdjustStuttering(rand(0,5)) if(prob(25)) M.emote(pick("choke","gasp")) - M.adjustOxyLoss(5) + update_flags |= M.adjustOxyLoss(5, FALSE) else if(effect <= 7) to_chat(M, "Your chest hurts!") M.emote(pick("cough","gasp")) - M.adjustOxyLoss(3) + update_flags |= M.adjustOxyLoss(3, FALSE) else if(severity == 2) if(effect <= 2) M.visible_message("[M] breaks out in hives!") - M.adjustBruteLoss(6) + update_flags |= M.adjustBruteLoss(6, FALSE) else if(effect <= 4) M.visible_message("[M] has a horrible coughing fit!") M.Jitter(10) - M.stuttering += rand(0,5) + M.AdjustStuttering(rand(0,5)) M.emote("cough") if(prob(40)) M.emote(pick("choke","gasp")) - M.adjustOxyLoss(6) - M.Weaken(8) + update_flags |= M.adjustOxyLoss(6, FALSE) + update_flags |= M.Weaken(8, FALSE) else if(effect <= 7) to_chat(M, "Your heartbeat is pounding inside your head!") M << 'sound/effects/singlebeat.ogg' M.emote("collapse") - M.adjustOxyLoss(8) - M.adjustToxLoss(3) - M.Weaken(3) + update_flags |= M.adjustOxyLoss(8, FALSE) + update_flags |= M.adjustToxLoss(3, FALSE) + update_flags |= M.Weaken(3, FALSE) M.emote(pick("choke", "gasp")) to_chat(M, "You feel like you're dying!") + return list(effect, update_flags) /datum/reagent/formaldehyde name = "Formaldehyde" @@ -429,10 +445,11 @@ penetrates_skin = TRUE /datum/reagent/formaldehyde/on_mob_life(mob/living/M) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(10)) M.reagents.add_reagent("histamine",rand(5,15)) - ..() + return ..() | update_flags /datum/reagent/venom name = "Venom" @@ -445,26 +462,29 @@ can_synth = FALSE /datum/reagent/venom/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(25)) M.reagents.add_reagent("histamine",rand(5,10)) if(volume < 20) - M.adjustToxLoss(1) - M.adjustBruteLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustBruteLoss(1, FALSE) else if(volume < 40) if(prob(8)) M.fakevomit() - M.adjustToxLoss(2) - M.adjustBruteLoss(2) - ..() + update_flags |= M.adjustToxLoss(2, FALSE) + update_flags |= M.adjustBruteLoss(2, FALSE) + return ..() | update_flags /datum/reagent/venom/overdose_process(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(volume >= 40) if(prob(4)) M.visible_message("[M] starts convulsing violently!", "You feel as if your body is tearing itself apart!") - M.Weaken(15) + update_flags |= M.Weaken(15, FALSE) M.AdjustJitter(1000) spawn(rand(20, 100)) M.gib() + return list(0, update_flags) /datum/reagent/neurotoxin2 name = "Neurotoxin" @@ -475,6 +495,7 @@ metabolization_rate = 1 /datum/reagent/neurotoxin2/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 4) current_cycle++ @@ -489,19 +510,19 @@ if(13) M.emote("faint") if(14 to INFINITY) - M.Paralyse(10) + update_flags |= M.Paralyse(10, FALSE) M.Drowsy(20) M.AdjustJitter(-30) if(M.getBrainLoss() <= 80) - M.adjustBrainLoss(1) + update_flags |= M.adjustBrainLoss(1, FALSE) else if(prob(10)) - M.adjustBrainLoss(1) + update_flags |= M.adjustBrainLoss(1, FALSE) if(prob(10)) M.emote("drool") - M.adjustToxLoss(1) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/cyanide name = "Cyanide" @@ -514,7 +535,8 @@ taste_message = "almonds" /datum/reagent/cyanide/on_mob_life(mob/living/M) - M.adjustToxLoss(1.5*REAGENTS_EFFECT_MULTIPLIER) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1.5*REAGENTS_EFFECT_MULTIPLIER, FALSE) if(prob(5)) M.emote("drool") if(prob(10)) @@ -523,9 +545,9 @@ M.emote("gasp") if(prob(8)) to_chat(M, "You feel horrendously weak!") - M.Stun(2) - M.adjustToxLoss(2) - ..() + update_flags |= M.Stun(2, FALSE) + update_flags |= M.adjustToxLoss(2, FALSE) + return ..() | update_flags /datum/reagent/itching_powder name = "Itching Powder" @@ -537,6 +559,7 @@ penetrates_skin = TRUE /datum/reagent/itching_powder/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_STAT if(prob(25)) M.emote(pick("twitch", "laugh", "sneeze", "cry")) if(prob(20)) @@ -544,22 +567,22 @@ M.emote(pick("laugh", "giggle")) if(prob(15)) M.visible_message("[M] scratches at an itch.") - M.adjustBruteLoss(1) - M.Stun(rand(0,1)) + update_flags |= M.adjustBruteLoss(1, FALSE) + update_flags |= M.Stun(rand(0,1), FALSE) M.emote("grumble") if(prob(10)) to_chat(M, "So itchy!") - M.adjustBruteLoss(2) + update_flags |= M.adjustBruteLoss(2, FALSE) if(prob(6)) M.reagents.add_reagent("histamine", rand(1,3)) if(prob(2)) to_chat(M, "AHHHHHH!") - M.adjustBruteLoss(5) - M.Weaken(5) + update_flags |= M.adjustBruteLoss(5, FALSE) + update_flags |= M.Weaken(5, FALSE) M.AdjustJitter(6) M.visible_message("[M] falls to the floor, scratching [M.p_them()]self violently!") M.emote("scream") - ..() + return ..() | update_flags /datum/reagent/facid name = "Fluorosulfuric Acid" @@ -571,9 +594,10 @@ taste_message = "ACID" /datum/reagent/facid/on_mob_life(mob/living/M) - M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER) - M.adjustFireLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1*REAGENTS_EFFECT_MULTIPLIER, FALSE) + update_flags |= M.adjustFireLoss(1, FALSE) + return ..() | update_flags /datum/reagent/facid/reaction_mob(mob/living/M, method=TOUCH, volume) if(method == TOUCH || method == INGEST) @@ -635,26 +659,27 @@ taste_message = null /datum/reagent/initropidril/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(33)) - M.adjustToxLoss(rand(5,25)) + update_flags |= M.adjustToxLoss(rand(5,25), FALSE) if(prob(33)) to_chat(M, "You feel horribly weak.") - M.Stun(2) + update_flags |= M.Stun(2, FALSE) if(prob(10)) to_chat(M, "You cannot breathe!") - M.adjustOxyLoss(10) + update_flags |= M.adjustOxyLoss(10, FALSE) M.AdjustLoseBreath(1) if(prob(10)) to_chat(M, "Your chest is burning with pain!") - M.adjustOxyLoss(10) + update_flags |= M.adjustOxyLoss(10, FALSE) M.AdjustLoseBreath(1) - M.Stun(3) - M.Weaken(2) + update_flags |= M.Stun(3, FALSE) + update_flags |= M.Weaken(2, FALSE) if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.undergoing_cardiac_arrest()) H.set_heartattack(TRUE) // rip in pepperoni - ..() + return ..() | update_flags /datum/reagent/pancuronium name = "Pancuronium" @@ -666,6 +691,7 @@ taste_message = null /datum/reagent/pancuronium/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 5) if(prob(10)) @@ -673,12 +699,12 @@ if(6 to 10) if(prob(8)) to_chat(M, "You feel [pick("weak", "horribly weak", "numb", "like you can barely move", "tingly")].") - M.Stun(1) + update_flags |= M.Stun(1, FALSE) else if(prob(8)) M.emote(pick("drool", "tremble")) if(11 to INFINITY) - M.Stun(20) - M.Weaken(20) + update_flags |= M.Stun(20, FALSE) + update_flags |= M.Weaken(20, FALSE) if(prob(10)) M.emote(pick("drool", "tremble", "gasp")) M.AdjustLoseBreath(1) @@ -687,7 +713,7 @@ if(prob(7)) to_chat(M, "You can't breathe!") M.AdjustLoseBreath(3) - ..() + return ..() | update_flags /datum/reagent/sodium_thiopental name = "Sodium Thiopental" @@ -700,6 +726,7 @@ taste_message = null /datum/reagent/sodium_thiopental/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1) M.emote("drool") @@ -708,14 +735,14 @@ M.Drowsy(20) if(5) M.emote("faint") - M.Weaken(5) + update_flags |= M.Weaken(5, FALSE) if(6 to INFINITY) - M.Paralyse(20) + update_flags |= M.Paralyse(20, FALSE) M.AdjustJitter(-50) if(prob(10)) M.emote("drool") - M.adjustBrainLoss(1) - ..() + update_flags |= M.adjustBrainLoss(1, FALSE) + return ..() | update_flags /datum/reagent/ketamine name = "Ketamine" @@ -729,20 +756,21 @@ taste_message = null /datum/reagent/ketamine/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 5) if(prob(25)) M.emote("yawn") if(6 to 9) - M.AdjustEyeBlurry(5) + update_flags |= M.AdjustEyeBlurry(5, FALSE) if(prob(35)) M.emote("yawn") if(10) M.emote("faint") - M.Weaken(5) + update_flags |= M.Weaken(5, FALSE) if(11 to INFINITY) - M.Paralyse(25) - ..() + update_flags |= M.Paralyse(25, FALSE) + return ..() | update_flags /datum/reagent/sulfonal name = "Sulfonal" @@ -753,6 +781,7 @@ metabolization_rate = 0.1 /datum/reagent/sulfonal/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustJitter(-30) switch(current_cycle) if(1 to 10) @@ -765,10 +794,10 @@ if(22 to INFINITY) if(prob(20)) M.emote("faint") - M.Paralyse(5) + update_flags |= M.Paralyse(5, FALSE) M.Drowsy(20) - M.adjustToxLoss(1) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/amanitin name = "Amanitin" @@ -792,19 +821,20 @@ taste_message = "battery acid" /datum/reagent/lipolicide/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(!M.nutrition) switch(rand(1,3)) if(1) to_chat(M, "You feel hungry...") if(2) - M.adjustToxLoss(1) + update_flags |= M.adjustToxLoss(1, FALSE) to_chat(M, "Your stomach grumbles painfully!") else if(prob(60)) var/fat_to_burn = max(round(M.nutrition/100,1), 5) M.nutrition = max(0, M.nutrition-fat_to_burn) M.overeatduration = 0 - ..() + return ..() | update_flags /datum/reagent/coniine name = "Coniine" @@ -816,9 +846,10 @@ can_synth = FALSE /datum/reagent/coniine/on_mob_life(mob/living/M) - M.adjustToxLoss(2) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(2, FALSE) M.AdjustLoseBreath(5) - ..() + return ..() | update_flags /datum/reagent/curare name = "Curare" @@ -830,28 +861,29 @@ penetrates_skin = TRUE /datum/reagent/curare/on_mob_life(mob/living/M) - M.adjustToxLoss(1) - M.adjustOxyLoss(1) + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustOxyLoss(1, FALSE) switch(current_cycle) if(1 to 5) if(prob(20)) M.emote(pick("drool", "pale", "gasp")) if(6 to 10) - M.AdjustEyeBlurry(5) + update_flags |= M.AdjustEyeBlurry(5, FALSE) if(prob(8)) to_chat(M, "You feel [pick("weak", "horribly weak", "numb", "like you can barely move", "tingly")].") - M.Stun(1) + update_flags |= M.Stun(1, FALSE) else if(prob(8)) - M.emote(pick("drool","pale", "gasp")) + M.emote(pick("drool", "pale", "gasp")) if(11 to INFINITY) - M.Stun(30) + update_flags |= M.Stun(30, FALSE) M.Drowsy(20) if(prob(20)) M.emote(pick("drool", "faint", "pale", "gasp", "collapse")) else if(prob(8)) to_chat(M, "You can't [pick("breathe", "move", "feel your legs", "feel your face", "feel anything")]!") M.AdjustLoseBreath(1) - ..() + return ..() | update_flags /datum/reagent/heparin //Based on a real-life anticoagulant. name = "Heparin" @@ -862,11 +894,12 @@ metabolization_rate = 0.2 * REAGENTS_METABOLISM /datum/reagent/heparin/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(ishuman(M)) var/mob/living/carbon/human/H = M H.bleed_rate = min(H.bleed_rate + 2, 8) - H.adjustBruteLoss(1) - ..() + update_flags |= H.adjustBruteLoss(1, FALSE) + return ..() | update_flags /datum/reagent/sarin name = "Sarin" @@ -880,6 +913,7 @@ taste_message = null /datum/reagent/sarin/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 15) M.AdjustJitter(20) @@ -888,23 +922,23 @@ if(16 to 30) if(prob(25)) M.emote(pick("twitch","twitch","drool","quiver","tremble")) - M.AdjustEyeBlurry(5) + update_flags |= M.AdjustEyeBlurry(5, FALSE) M.Stuttering(5) if(prob(10)) M.Confused(15) if(prob(15)) - M.Stun(1) + update_flags |= M.Stun(1, FALSE) M.emote("scream") if(30 to 60) - M.AdjustEyeBlurry(5) + update_flags |= M.AdjustEyeBlurry(5, FALSE) M.Stuttering(5) if(prob(10)) - M.Stun(1) + update_flags |= M.Stun(1, FALSE) M.emote(pick("twitch","twitch","drool","shake","tremble")) if(prob(5)) M.emote("collapse") if(prob(5)) - M.Weaken(3) + update_flags |= M.Weaken(3, FALSE) M.visible_message("[M] has a seizure!") M.SetJitter(1000) if(prob(5)) @@ -915,15 +949,15 @@ if(prob(15)) M.emote(pick("gasp", "choke", "cough","twitch", "shake", "tremble","quiver","drool", "twitch","collapse")) M.LoseBreath(5) - M.adjustToxLoss(1) - M.adjustBrainLoss(1) - M.Weaken(4) + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.Weaken(4, FALSE) if(prob(8)) M.fakevomit() - M.adjustToxLoss(1) - M.adjustBrainLoss(1) - M.adjustFireLoss(1) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustBrainLoss(1, FALSE) + update_flags |= M.adjustFireLoss(1, FALSE) + return ..() | update_flags /datum/reagent/glyphosate name = "Glyphosate" @@ -934,8 +968,9 @@ var/lethality = 0 //Glyphosate is non-toxic to people /datum/reagent/glyphosate/on_mob_life(mob/living/M) - M.adjustToxLoss(lethality) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(lethality, FALSE) + return ..() | update_flags /datum/reagent/glyphosate/reaction_turf(turf/simulated/wall/W, volume) // Clear off wallrot fungi if(istype(W) && W.rotting) @@ -985,8 +1020,9 @@ color = "#4B004B" // rgb: 75, 0, 75 /datum/reagent/pestkiller/on_mob_life(mob/living/M) - M.adjustToxLoss(1) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustToxLoss(1, FALSE) + return ..() | update_flags /datum/reagent/pestkiller/reaction_mob(mob/living/M, method=TOUCH, volume) if(iscarbon(M)) @@ -1008,19 +1044,20 @@ taste_message = "sweetness" /datum/reagent/capulettium/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE switch(current_cycle) if(1 to 5) - M.AdjustEyeBlurry(10) + update_flags |= M.AdjustEyeBlurry(10, FALSE) if(6 to 10) M.Drowsy(10) if(11) - M.Paralyse(10) + update_flags |= M.Paralyse(10, FALSE) M.visible_message("[M] seizes up and falls limp, [M.p_their()] eyes dead and lifeless...") //so you can't trigger deathgasp emote on people. Edge case, but necessary. if(12 to 60) - M.Paralyse(10) + update_flags |= M.Paralyse(10, FALSE) if(61 to INFINITY) - M.AdjustEyeBlurry(10) - ..() + update_flags |= M.AdjustEyeBlurry(10, FALSE) + return ..() | update_flags /datum/reagent/capulettium_plus name = "Capulettium Plus" @@ -1033,7 +1070,7 @@ /datum/reagent/capulettium_plus/on_mob_life(mob/living/M) M.Silence(2) - ..() + return ..() /datum/reagent/toxic_slurry name = "Toxic Slurry" @@ -1043,14 +1080,15 @@ color = "#00C81E" /datum/reagent/toxic_slurry/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(prob(10)) - M.adjustToxLoss(rand(2.4)) + update_flags |= M.adjustToxLoss(rand(2.4), FALSE) if(prob(7)) to_chat(M, "A horrible migraine overpowers you.") - M.Stun(rand(2,5)) + update_flags |= M.Stun(rand(2,5), FALSE) if(prob(7)) M.fakevomit(1) - ..() + return ..() | update_flags /datum/reagent/glowing_slurry name = "Glowing Slurry" @@ -1079,7 +1117,7 @@ randmutg(M) domutcheck(M, null) M.UpdateAppearance() - ..() + return ..() /datum/reagent/ants name = "Ants" @@ -1091,8 +1129,9 @@ taste_message = "ANTS OH GOD" /datum/reagent/ants/on_mob_life(mob/living/M) - M.adjustBruteLoss(2) - ..() + var/update_flags = STATUS_UPDATE_NONE + update_flags |= M.adjustBruteLoss(2, FALSE) + return ..() | update_flags /datum/reagent/ants/reaction_mob(mob/living/M, method=TOUCH, volume) //NOT THE ANTS if(iscarbon(M)) @@ -1118,4 +1157,4 @@ shock_timer = 0 M.electrocute_act(rand(5,20), "Teslium in their body", 1, 1) //Override because it's caused from INSIDE of you playsound(M, "sparks", 50, 1) - ..() + return ..() diff --git a/code/modules/reagents/chemistry/reagents/water.dm b/code/modules/reagents/chemistry/reagents/water.dm index 7779cb91d85..cb1dfb0928e 100644 --- a/code/modules/reagents/chemistry/reagents/water.dm +++ b/code/modules/reagents/chemistry/reagents/water.dm @@ -316,7 +316,7 @@ M.fakevomit(1) else M.fakevomit(0) - ..() + return ..() /datum/reagent/fishwater/toiletwater name = "Toilet Water" @@ -342,6 +342,7 @@ taste_message = null /datum/reagent/holywater/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.AdjustJitter(-5) if(current_cycle >= 30) // 12 units, 60 seconds @ metabolism 0.4 units & tick rate 2.0 sec M.AdjustStuttering(4, bound_lower = 0, bound_upper = 20) @@ -370,7 +371,7 @@ if(M.mind.vampire.bloodusable) M.Stuttering(1) M.Jitter(30) - M.adjustStaminaLoss(5) + update_flags |= M.adjustStaminaLoss(5, FALSE) if(prob(20)) M.emote("scream") M.mind.vampire.nullified = max(5, M.mind.vampire.nullified + 2) @@ -388,7 +389,7 @@ M.mind.vampire.nullified = max(5, M.mind.vampire.nullified + 2) if(5 to 12) to_chat(M, "You feel an intense burning inside of you!") - M.adjustFireLoss(1) + update_flags |= M.adjustFireLoss(1, FALSE) M.Stuttering(1) M.Jitter(20) if(prob(20)) @@ -400,13 +401,13 @@ O.show_message(text("[] suddenly bursts into flames!", M), 1) M.fire_stacks = min(5,M.fire_stacks + 3) M.IgniteMob() //Only problem with igniting people is currently the commonly availible fire suits make you immune to being on fire - M.adjustFireLoss(3) //Hence the other damages... ain't I a bastard? + update_flags |= M.adjustFireLoss(3, FALSE) //Hence the other damages... ain't I a bastard? M.Stuttering(1) M.Jitter(30) if(prob(40)) M.emote("scream") M.mind.vampire.nullified = max(5, M.mind.vampire.nullified + 2) - ..() + return ..() | update_flags /datum/reagent/holywater/reaction_mob(mob/living/M, method=TOUCH, volume) @@ -442,23 +443,24 @@ taste_message = null /datum/reagent/fuel/unholywater/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE if(iscultist(M)) M.AdjustDrowsy(-5) - M.AdjustParalysis(-1) - M.AdjustStunned(-2) - M.AdjustWeakened(-2) - M.adjustToxLoss(-2) - M.adjustFireLoss(-2) - M.adjustOxyLoss(-2) - M.adjustBruteLoss(-2) + update_flags |= M.AdjustParalysis(-1, FALSE) + update_flags |= M.AdjustStunned(-2, FALSE) + update_flags |= M.AdjustWeakened(-2, FALSE) + update_flags |= M.adjustToxLoss(-2, FALSE) + update_flags |= M.adjustFireLoss(-2, FALSE) + update_flags |= M.adjustOxyLoss(-2, FALSE) + update_flags |= M.adjustBruteLoss(-2, FALSE) else - M.adjustBrainLoss(3) - M.adjustToxLoss(1) - M.adjustFireLoss(2) - M.adjustOxyLoss(2) - M.adjustBruteLoss(2) + update_flags |= M.adjustBrainLoss(3, FALSE) + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustFireLoss(2, FALSE) + update_flags |= M.adjustOxyLoss(2, FALSE) + update_flags |= M.adjustBruteLoss(2, FALSE) M.AdjustCultSlur(10)//CUASE WHY THE HELL NOT - ..() + return ..() | update_flags /datum/reagent/hellwater name = "Hell Water" @@ -470,12 +472,13 @@ taste_message = "admin abuse" /datum/reagent/hellwater/on_mob_life(mob/living/M) + var/update_flags = STATUS_UPDATE_NONE M.fire_stacks = min(5, M.fire_stacks + 3) M.IgniteMob() //Only problem with igniting people is currently the commonly availible fire suits make you immune to being on fire - M.adjustToxLoss(1) - M.adjustFireLoss(1) //Hence the other damages... ain't I a bastard? - M.adjustBrainLoss(5) - ..() + update_flags |= M.adjustToxLoss(1, FALSE) + update_flags |= M.adjustFireLoss(1, FALSE) //Hence the other damages... ain't I a bastard? + update_flags |= M.adjustBrainLoss(5, FALSE) + return ..() | update_flags /datum/reagent/liquidgibs name = "Liquid gibs" diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 6a1f7883312..78e7ad47f57 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -580,7 +580,7 @@ /* if(hasmob && prob(3)) for(var/mob/living/H in src) if(!istype(H,/mob/living/silicon/robot/drone)) //Drones use the mailing code to move through the disposal system, - H.take_overall_damage(20, 0, "Blunt Trauma") */ //horribly maim any living creature jumping down disposals. c'est la vie + H.take_overall_damage(20, 0, TRUE, "Blunt Trauma") */ //horribly maim any living creature jumping down disposals. c'est la vie if(has_fat_guy && prob(2)) // chance of becoming stuck per segment if contains a fat guy active = 0 diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 04ce880d5f5..02a6d54a073 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -141,7 +141,7 @@ DAMAGE PROCS ****************************************************/ -/obj/item/organ/external/receive_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE) +/obj/item/organ/external/receive_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE, updating_health = TRUE) if(tough && !ignore_resists) brute = max(0, brute - 5) burn = max(0, burn - 4) @@ -232,14 +232,14 @@ droplimb(0, DROPLIMB_SHARP) if(owner_old) - owner_old.updatehealth() + owner_old.updatehealth("limb receive damage") return update_icon() #undef LIMB_SHARP_THRESH_INT_DMG #undef LIMB_THRESH_INT_DMG #undef LIMB_DMG_PROB -/obj/item/organ/external/proc/heal_damage(brute, burn, internal = 0, robo_repair = 0) +/obj/item/organ/external/proc/heal_damage(brute, burn, internal = 0, robo_repair = 0, updating_health = TRUE) if(is_robotic() && !robo_repair) return @@ -250,7 +250,8 @@ status &= ~ORGAN_BROKEN perma_injury = 0 - owner.updatehealth() + if(updating_health) + owner.updatehealth("limb heal damage") return update_icon() @@ -279,7 +280,7 @@ This function completely restores a damaged organ to perfect condition. EO.rejuvenate() if(owner) - owner.updatehealth() + owner.updatehealth("limb rejuvenate") update_icon() if(!owner) processing_objects |= src @@ -497,7 +498,7 @@ Note that amputating the affected organ does in fact remove the infection from t dir = 2 if(victim) - victim.updatehealth() + victim.updatehealth("droplimb") victim.UpdateDamageIcon() victim.regenerate_icons() @@ -708,6 +709,7 @@ Note that amputating the affected organ does in fact remove the infection from t var/atom/movable/thing = O.remove(victim) if(thing) thing.forceMove(src) + victim.updatehealth("limb remove") // Grab all the internal giblets too. for(var/obj/item/organ/internal/organ in internal_organs) diff --git a/code/modules/surgery/organs/vocal_cords.dm b/code/modules/surgery/organs/vocal_cords.dm index b6de54e8046..c13c4da83f6 100644 --- a/code/modules/surgery/organs/vocal_cords.dm +++ b/code/modules/surgery/organs/vocal_cords.dm @@ -231,7 +231,7 @@ var/static/regex/multispin_words = regex("like a record baby") else if((findtext(message, heal_words))) for(var/V in listeners) var/mob/living/L = V - L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, 0, 0) + L.heal_overall_damage(10 * power_multiplier, 10 * power_multiplier, TRUE, 0, 0) next_command = world.time + cooldown_damage //BRUTE DAMAGE diff --git a/code/modules/vr/vr_avatar.dm b/code/modules/vr/vr_avatar.dm index 510871fb40a..4719ffc4961 100644 --- a/code/modules/vr/vr_avatar.dm +++ b/code/modules/vr/vr_avatar.dm @@ -16,7 +16,8 @@ ..() /mob/living/carbon/human/virtual_reality/death() - return_to_lobby() + if(can_die()) + return_to_lobby() return ..() /mob/living/carbon/human/virtual_reality/Destroy() diff --git a/paradise.dme b/paradise.dme index de38b9a410d..505fae7109c 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1626,7 +1626,6 @@ #include "code\modules\mob\living\carbon\alien\humanoid\caste\drone.dm" #include "code\modules\mob\living\carbon\alien\humanoid\caste\hunter.dm" #include "code\modules\mob\living\carbon\alien\humanoid\caste\sentinel.dm" -#include "code\modules\mob\living\carbon\alien\larva\death.dm" #include "code\modules\mob\living\carbon\alien\larva\emote.dm" #include "code\modules\mob\living\carbon\alien\larva\inventory.dm" #include "code\modules\mob\living\carbon\alien\larva\larva.dm" @@ -1666,6 +1665,7 @@ #include "code\modules\mob\living\carbon\human\shock.dm" #include "code\modules\mob\living\carbon\human\status_procs.dm" #include "code\modules\mob\living\carbon\human\update_icons.dm" +#include "code\modules\mob\living\carbon\human\update_stat.dm" #include "code\modules\mob\living\carbon\human\whisper.dm" #include "code\modules\mob\living\carbon\human\interactive\functions.dm" #include "code\modules\mob\living\carbon\human\interactive\interactive.dm"