From b34c14739b54011c8571a09ac30615255b00961a Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Tue, 25 Jul 2017 08:15:25 -0400 Subject: [PATCH 1/3] Various little fixes/refactors --- .../gamemodes/changeling/powers/revive.dm | 2 +- code/modules/mob/living/carbon/human/life.dm | 51 ------------- code/modules/mob/living/carbon/human/shock.dm | 74 +++++++++++++++++++ .../living/carbon/human/species/station.dm | 2 - code/modules/mob/living/carbon/shock.dm | 38 ---------- .../surgery/organs/augments_internal.dm | 4 +- code/modules/surgery/organs/organ.dm | 6 +- code/modules/surgery/organs/organ_external.dm | 14 ++-- code/modules/surgery/organs/subtypes/xenos.dm | 14 +--- code/modules/surgery/surgery.dm | 13 ++-- paradise.dme | 2 +- 11 files changed, 95 insertions(+), 125 deletions(-) create mode 100644 code/modules/mob/living/carbon/human/shock.dm delete mode 100644 code/modules/mob/living/carbon/shock.dm diff --git a/code/game/gamemodes/changeling/powers/revive.dm b/code/game/gamemodes/changeling/powers/revive.dm index feb6615971b..b6f3062c66a 100644 --- a/code/game/gamemodes/changeling/powers/revive.dm +++ b/code/game/gamemodes/changeling/powers/revive.dm @@ -24,11 +24,11 @@ user.reagents.clear_reagents() user.germ_level = 0 user.next_pain_time = 0 - user.traumatic_shock = 0 user.timeofdeath = 0 if(ishuman(user)) var/mob/living/carbon/human/H = user H.restore_blood() + H.traumatic_shock = 0 H.shock_stage = 0 H.species.create_organs(H) // Now that recreating all organs is necessary, the rest of this organ stuff probably diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ee5d773938c..70390d6573c 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -972,57 +972,6 @@ if(hud_used) hud_used.lingchemdisplay.invisibility = 101 -/mob/living/carbon/human/handle_shock() - ..() - if(status_flags & GODMODE) - return 0 //godmode - if(NO_PAIN in species.species_traits) - return - - if(health <= config.health_threshold_softcrit)// health 0 makes you immediately collapse - shock_stage = max(shock_stage, 61) - - if(traumatic_shock >= 100) - shock_stage += 1 - else - shock_stage = min(shock_stage, 160) - shock_stage = max(shock_stage-1, 0) - return - - if(shock_stage == 10) - to_chat(src, ""+pick("It hurts so much!", "You really need some painkillers..", "Dear god, the pain!")) - - if(shock_stage >= 30) - if(shock_stage == 30) custom_emote(1,"is having trouble keeping their eyes open.") - EyeBlurry(2) - Stuttering(5) - - if(shock_stage == 40) - to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) - - if(shock_stage >=60) - if(shock_stage == 60) custom_emote(1,"falls limp.") - if(prob(2)) - to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) - Weaken(20) - - if(shock_stage >= 80) - if(prob(5)) - to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) - Weaken(20) - - if(shock_stage >= 120) - if(prob(2)) - to_chat(src, ""+pick("You black out!", "You feel like you could die any moment now.", "You're about to lose consciousness.")) - Paralyse(5) - - if(shock_stage == 150) - custom_emote(1,"can no longer stand, collapsing!") - Weaken(20) - - if(shock_stage >= 150) - Weaken(20) - /mob/living/carbon/human/proc/handle_pulse() diff --git a/code/modules/mob/living/carbon/human/shock.dm b/code/modules/mob/living/carbon/human/shock.dm new file mode 100644 index 00000000000..b31bab95fa9 --- /dev/null +++ b/code/modules/mob/living/carbon/human/shock.dm @@ -0,0 +1,74 @@ +/mob/living/carbon/human/var/traumatic_shock = 0 +/mob/living/carbon/human/var/shock_stage = 0 + +// proc to find out in how much pain the mob is at the moment +/mob/living/carbon/human/proc/updateshock() + traumatic_shock = getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss() + + // broken or ripped off organs will add quite a bit of pain + for(var/thing in bodyparts) + var/obj/item/organ/external/BP = thing + if(BP.status & ORGAN_BROKEN && !(BP.status & ORGAN_SPLINTED) || BP.open) + traumatic_shock += 15 + + if(reagents) + for(var/datum/reagent/R in reagents.reagent_list) + if(R.shock_reduction) + traumatic_shock = max(0, traumatic_shock - R.shock_reduction) // now you too can varedit cyanide to reduce shock by 1000 - Iamgoofball + if(drunk) + traumatic_shock = max(0, traumatic_shock - 10) + + return traumatic_shock + +/mob/living/carbon/human/proc/handle_shock() + updateshock() + if(status_flags & GODMODE) //godmode + return + if(NO_PAIN in species.species_traits) + return + + if(health <= config.health_threshold_softcrit)// health 0 makes you immediately collapse + shock_stage = max(shock_stage, 61) + + if(traumatic_shock >= 100) + shock_stage += 1 + else + shock_stage = min(shock_stage, 160) + shock_stage = max(shock_stage-1, 0) + return + + if(shock_stage == 10) + to_chat(src, ""+pick("It hurts so much!", "You really need some painkillers..", "Dear god, the pain!")) + + if(shock_stage >= 30) + if(shock_stage == 30) + custom_emote(1,"is having trouble keeping their eyes open.") + EyeBlurry(2) + Stuttering(5) + + if(shock_stage == 40) + to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) + + if(shock_stage >=60) + if(shock_stage == 60) + custom_emote(1,"falls limp.") + if(prob(2)) + to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) + Weaken(20) + + if(shock_stage >= 80) + if(prob(5)) + to_chat(src, ""+pick("The pain is excrutiating!", "Please, just end the pain!", "Your whole body is going numb!")) + Weaken(20) + + if(shock_stage >= 120) + if(prob(2)) + to_chat(src, ""+pick("You black out!", "You feel like you could die any moment now.", "You're about to lose consciousness.")) + Paralyse(5) + + if(shock_stage == 150) + custom_emote(1,"can no longer stand, collapsing!") + Weaken(20) + + if(shock_stage >= 150) + Weaken(20) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/station.dm b/code/modules/mob/living/carbon/human/species/station.dm index 6292e2971b8..e9dea804cac 100644 --- a/code/modules/mob/living/carbon/human/species/station.dm +++ b/code/modules/mob/living/carbon/human/species/station.dm @@ -866,7 +866,6 @@ 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) - H.traumatic_shock -= light_amount if(light_amount > 0) H.clear_alert("nolight") @@ -879,7 +878,6 @@ H.adjustFireLoss(-(light_amount/4)) if(H.nutrition < NUTRITION_LEVEL_STARVING+50) H.take_overall_damage(10,0) - H.traumatic_shock++ /datum/species/machine name = "Machine" diff --git a/code/modules/mob/living/carbon/shock.dm b/code/modules/mob/living/carbon/shock.dm deleted file mode 100644 index b86f88c4ff4..00000000000 --- a/code/modules/mob/living/carbon/shock.dm +++ /dev/null @@ -1,38 +0,0 @@ -/mob/living/var/traumatic_shock = 0 -/mob/living/carbon/var/shock_stage = 0 - -// proc to find out in how much pain the mob is at the moment -/mob/living/carbon/proc/updateshock() - src.traumatic_shock = \ - 1 * src.getOxyLoss() + \ - 1 * src.getToxLoss() + \ - 1 * src.getFireLoss() + \ - 1 * src.getBruteLoss() + \ - 1 * src.getCloneLoss() - - if(reagents) - for(var/datum/reagent/R in reagents.reagent_list) - if(R.shock_reduction) - src.traumatic_shock -= R.shock_reduction // now you too can varedit cyanide to reduce shock by 1000 - Iamgoofball - if(src.slurring) - src.traumatic_shock -= 10 - - // broken or ripped off organs will add quite a bit of pain - if(istype(src,/mob/living/carbon/human)) - var/mob/living/carbon/human/M = src - for(var/obj/item/organ/external/organ in M.bodyparts) - if(!organ) - continue - else if(organ.status & ORGAN_BROKEN || organ.open) - src.traumatic_shock += 15 - if(organ.status & ORGAN_SPLINTED) - src.traumatic_shock -= 15 - - if(src.traumatic_shock < 0) - src.traumatic_shock = 0 - - return src.traumatic_shock - - -/mob/living/carbon/proc/handle_shock() - updateshock() diff --git a/code/modules/surgery/organs/augments_internal.dm b/code/modules/surgery/organs/augments_internal.dm index 0a99a9b9e5a..7d5e03ea046 100644 --- a/code/modules/surgery/organs/augments_internal.dm +++ b/code/modules/surgery/organs/augments_internal.dm @@ -6,8 +6,8 @@ status = ORGAN_ROBOT var/implant_color = "#FFFFFF" var/implant_overlay - tough = 1 //not easyly broken by combat damage - sterile = 1 //not very germy + tough = TRUE // Immune to damage + sterile = TRUE // Doesn't accumulate germs robotic = 2 // these are cybernetic after all /obj/item/organ/internal/cyberimp/New(var/mob/M = null) diff --git a/code/modules/surgery/organs/organ.dm b/code/modules/surgery/organs/organ.dm index a59542bd2af..8f965f19789 100644 --- a/code/modules/surgery/organs/organ.dm +++ b/code/modules/surgery/organs/organ.dm @@ -29,8 +29,8 @@ var/list/organ_cache = list() var/freezer_update_period = 100 var/is_in_freezer = 0 - var/sterile = 0 //can the organ be infected by germs? - var/tough = 0 //can organ be easily damaged? + var/sterile = FALSE //can the organ be infected by germs? + var/tough = TRUE //can organ be easily damaged? /obj/item/organ/Destroy() @@ -95,7 +95,7 @@ var/list/organ_cache = list() return //Process infections - if((status & ORGAN_ROBOT) || sterile ||(owner && (IS_PLANT in owner.species.species_traits))) + if((status & ORGAN_ROBOT) || sterile || (owner && (IS_PLANT in owner.species.species_traits))) germ_level = 0 return diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index 5b8930f3016..e237557205b 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -97,25 +97,24 @@ switch(open) if(0) if(istype(W,/obj/item/weapon/scalpel)) - spread_germs_to_organ(src,user, W) + spread_germs_to_organ(src, user, W) user.visible_message("[user] cuts [src] open with [W]!") open++ return if(1) if(istype(W,/obj/item/weapon/retractor)) - spread_germs_to_organ(src,user, W) + spread_germs_to_organ(src, user, W) user.visible_message("[user] cracks [src] open like an egg with [W]!") open++ return if(2) if(istype(W,/obj/item/weapon/hemostat)) - spread_germs_to_organ(src,user, W) + spread_germs_to_organ(src, user, W) if(contents.len) var/obj/item/removing = pick(contents) var/obj/item/organ/internal/O = removing if(istype(O)) - if(!O.sterile) - spread_germs_to_organ(O,user, W) // This wouldn't be any cleaner than the actual surgery + spread_germs_to_organ(O, user, W) // This wouldn't be any cleaner than the actual surgery user.put_in_hands(removing) user.visible_message("[user] extracts [removing] from [src] with [W]!") else @@ -192,8 +191,7 @@ // Damage an internal organ if(internal_organs && internal_organs.len) var/obj/item/organ/internal/I = pick(internal_organs) - if(!I.tough)//mostly for cybernetic organs - I.take_damage(brute / 2) + I.take_damage(brute / 2) brute -= brute / 2 if(status & ORGAN_BROKEN && prob(40) && brute) @@ -591,7 +589,7 @@ Note that amputating the affected organ does in fact remove the infection from t burn_mod = 0.66 dismember_at_max_damage = TRUE else - tough = 1 + tough = TRUE // Robot parts also lack bones // This is so surgery isn't kaput, let's see how this does encased = null diff --git a/code/modules/surgery/organs/subtypes/xenos.dm b/code/modules/surgery/organs/subtypes/xenos.dm index 8f4434f41bc..bbe3f4387de 100644 --- a/code/modules/surgery/organs/subtypes/xenos.dm +++ b/code/modules/surgery/organs/subtypes/xenos.dm @@ -2,28 +2,18 @@ origin_tech = "biotech=5" icon_state = "xgibmid2" var/list/alien_powers = list() - tough = 1 - sterile = 1 - -///obj/item/organ/internal/xenos/New() -// for(var/A in alien_powers) -// if(ispath(A)) -// alien_powers -= A -// alien_powers += new A(src) -// ..() + tough = TRUE + sterile = TRUE ///can be changed if xenos get an update.. /obj/item/organ/internal/xenos/insert(mob/living/carbon/M, special = 0) ..() for(var/P in alien_powers) M.verbs |= P - //M.verbs |= alien_powers.Copy() /obj/item/organ/internal/xenos/remove(mob/living/carbon/M, special = 0) for(var/P in alien_powers) M.verbs -= P - //M.verbs -= alien_powers.Copy() - . = ..() /obj/item/organ/internal/xenos/prepare_eat() diff --git a/code/modules/surgery/surgery.dm b/code/modules/surgery/surgery.dm index a11be40d395..8861380527a 100644 --- a/code/modules/surgery/surgery.dm +++ b/code/modules/surgery/surgery.dm @@ -181,7 +181,7 @@ return null /proc/spread_germs_to_organ(obj/item/organ/E, mob/living/carbon/human/user, obj/item/tool) - if(!istype(user) || !istype(E)) + if(!istype(user) || !istype(E) || !(E.status & ORGAN_ROBOT) || E.sterile) return var/germ_level = user.germ_level @@ -189,12 +189,11 @@ //germ spread from surgeon touching the patient if(user.gloves) germ_level = user.gloves.germ_level - if(!(E.status & ORGAN_ROBOT)) //Germs on robotic limbs bad - E.germ_level = max(germ_level,E.germ_level) //as funny as scrubbing microbes out with clean gloves is - no. - spread_germs_by_incision(E,tool)//germ spread from environement to patient + E.germ_level += germ_level + spread_germs_by_incision(E, tool) //germ spread from environement to patient /proc/spread_germs_by_incision(obj/item/organ/external/E,obj/item/tool) - if(!istype(E,/obj/item/organ/external)) + if(!istype(E, /obj/item/organ/external)) return var/germs = 0 @@ -202,7 +201,7 @@ for(var/mob/living/carbon/human/H in view(2, E.loc))//germs from people if(AStar(E.loc, H.loc, /turf/proc/Distance, 2, simulated_only = 0)) if((!(NO_BREATH in H.mutations) || !(NO_BREATH in H.species.species_traits)) && !H.wear_mask) //wearing a mask helps preventing people from breathing cooties into open incisions - germs+=H.germ_level/4 + germs += H.germ_level * 0.25 for(var/obj/effect/decal/cleanable/M in view(2, E.loc))//germs from messes if(AStar(E.loc, M.loc, /turf/proc/Distance, 2, simulated_only = 0)) @@ -213,7 +212,7 @@ germs += 30 if(E.internal_organs.len) - germs = germs / E.internal_organs.len + germs = germs / (E.internal_organs.len + 1) // +1 for the external limb this eventually applies to; let's not multiply germs now. for(var/obj/item/organ/internal/O in E.internal_organs) if(!(O.status & ORGAN_ROBOT)) O.germ_level += germs diff --git a/paradise.dme b/paradise.dme index 1e66e3547b5..1f83b00753a 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1515,7 +1515,6 @@ #include "code\modules\mob\living\carbon\death.dm" #include "code\modules\mob\living\carbon\give.dm" #include "code\modules\mob\living\carbon\life.dm" -#include "code\modules\mob\living\carbon\shock.dm" #include "code\modules\mob\living\carbon\superheroes.dm" #include "code\modules\mob\living\carbon\update_icons.dm" #include "code\modules\mob\living\carbon\update_status.dm" @@ -1573,6 +1572,7 @@ #include "code\modules\mob\living\carbon\human\login.dm" #include "code\modules\mob\living\carbon\human\npcs.dm" #include "code\modules\mob\living\carbon\human\say.dm" +#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\whisper.dm" From 8c91244ea8e017704546f906197843b5b0b5c901 Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Tue, 25 Jul 2017 08:34:35 -0400 Subject: [PATCH 2/3] better --- code/modules/mob/living/carbon/human/shock.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/human/shock.dm b/code/modules/mob/living/carbon/human/shock.dm index b31bab95fa9..05042a226d6 100644 --- a/code/modules/mob/living/carbon/human/shock.dm +++ b/code/modules/mob/living/carbon/human/shock.dm @@ -21,12 +21,13 @@ return traumatic_shock /mob/living/carbon/human/proc/handle_shock() - updateshock() if(status_flags & GODMODE) //godmode return if(NO_PAIN in species.species_traits) return + updateshock() + if(health <= config.health_threshold_softcrit)// health 0 makes you immediately collapse shock_stage = max(shock_stage, 61) From 0f168fab4e424dd6b727c3f7def9ef43e5cd8e7a Mon Sep 17 00:00:00 2001 From: Fox-McCloud Date: Tue, 25 Jul 2017 15:40:56 -0400 Subject: [PATCH 3/3] multiplication memes --- code/modules/surgery/organs/organ_external.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/surgery/organs/organ_external.dm b/code/modules/surgery/organs/organ_external.dm index e237557205b..7c8aff47f43 100644 --- a/code/modules/surgery/organs/organ_external.dm +++ b/code/modules/surgery/organs/organ_external.dm @@ -191,8 +191,8 @@ // Damage an internal organ if(internal_organs && internal_organs.len) var/obj/item/organ/internal/I = pick(internal_organs) - I.take_damage(brute / 2) - brute -= brute / 2 + I.take_damage(brute * 0.5) + brute -= brute * 0.5 if(status & ORGAN_BROKEN && prob(40) && brute) owner.emote("scream") //getting hit on broken hand hurts