Added basic germ code.

This will only trigger in surgery for now - That is when you cut someone open in surgery, you'd better wash your hands before, or otherwise you'll get infected wounds.
This commit is contained in:
cib
2012-11-12 12:51:28 +01:00
parent 2d6e97848b
commit e92cecdefe
10 changed files with 72 additions and 12 deletions

View File

@@ -57,6 +57,15 @@ proc/build_surgery_steps_list()
var/datum/surgery_step/S = new T
surgery_steps += S
proc/spread_germs_to_organ(datum/organ/external/E, mob/living/carbon/human/user)
if(!istype(user) || !istype(E)) return
var/germ_level = user.germ_level
if(user.gloves)
germ_level = user.gloves.germ_level
E.germ_level = germ_level
//////////////////////////////////////////////////////////////////
// COMMON STEPS //
@@ -97,6 +106,7 @@ proc/build_surgery_steps_list()
"\blue You have made an incision on [target]'s [affected.display_name] with \the [tool].",)
affected.open = 1
affected.createwound(CUT, 1)
spread_germs_to_organ(affected, user)
if (target_zone == "head")
target.brain_op_stage = 1
@@ -126,6 +136,7 @@ proc/build_surgery_steps_list()
"\blue You clamp bleeders in [target]'s [affected.display_name] with \the [tool].")
affected.bandage()
affected.status &= ~ORGAN_BLEEDING
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -166,6 +177,7 @@ proc/build_surgery_steps_list()
self_msg = "\blue You keep the incision open on [target]'s lower abdomen with \the [tool]."
user.visible_message(msg, self_msg)
affected.open = 2
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -199,6 +211,7 @@ proc/build_surgery_steps_list()
user.visible_message("\blue [user] cauterizes the incision on [target]'s [affected.display_name] with \the [tool].", \
"\blue You cauterize the incision on [target]'s [affected.display_name] with \the [tool].")
affected.open = 0
affected.germ_level = 0
affected.status &= ~ORGAN_BLEEDING
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
@@ -282,7 +295,7 @@ proc/build_surgery_steps_list()
//////////////////////////////////////////////////////////////////
// INTERNAL WOUND PATCHING //
// INTERNAL WOUND PATCHING //
//////////////////////////////////////////////////////////////////
@@ -346,6 +359,7 @@ proc/build_surgery_steps_list()
user.visible_message("\blue [user] applies some [tool] to [target]'s bone in [affected.display_name]", \
"\blue You apply some [tool] to [target]'s bone in [affected.display_name] with \the [tool].")
affected.stage = 1
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -373,10 +387,12 @@ proc/build_surgery_steps_list()
user.visible_message("\blue [user] sets the bone in [target]'s [affected.display_name] in place with \the [tool].", \
"\blue You set the bone in [target]'s [affected.display_name] in place with \the [tool].")
affected.stage = 2
spread_germs_to_organ(affected, user)
else
user.visible_message("\blue [user] sets the bone in [target]'s [affected.display_name]\red in the WRONG place with \the [tool].", \
"\blue You set the bone in [target]'s [affected.display_name]\red in the WRONG place with \the [tool].")
affected.fracture()
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -403,6 +419,7 @@ proc/build_surgery_steps_list()
user.visible_message("\blue [user] sets [target]'s [affected.display_name] skull with \the [tool]." , \
"\blue You set [target]'s [affected.display_name] skull with \the [tool].")
affected.stage = 2
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -435,6 +452,7 @@ proc/build_surgery_steps_list()
affected.status &= ~ORGAN_SPLINTED
affected.stage = 0
affected.perma_injury = 0
spread_germs_to_organ(affected, user)
fail_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
@@ -691,7 +709,7 @@ proc/build_surgery_steps_list()
"You begin to cut through [target]'s skull with \the [tool].")
end_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("\blue [user] has cut through [target]'s skull open with \the [tool].", \
user.visible_message("\blue [user] has cut through [target]'s skull open with \the [tool].", \
"\blue You have cut through [target]'s skull open with \the [tool].")
target.brain_op_stage = 2
@@ -976,4 +994,4 @@ proc/build_surgery_steps_list()
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, damaging connectors on [target]'s [affected.display_name]!", \
"\red Your hand slips, damaging connectors on [target]'s [affected.display_name]!")
target.apply_damage(10, BRUTE, affected)
target.apply_damage(10, BRUTE, affected)

View File

@@ -33,6 +33,9 @@
var/open = 0
var/stage = 0
// INTERNAL germs inside the organ, this is BAD if it's greater 0
var/germ_level = 0
// how often wounds should be updated, a higher number means less often
var/wound_update_accuracy = 20 // update every 20 ticks(roughly every minute)
New(var/datum/organ/external/P)
@@ -195,6 +198,11 @@
// amount of healing is spread over all the wounds
W.heal_damage((wound_update_accuracy * amount * W.amount * config.organ_regeneration_multiplier) / (20*owner.number_wounds+1))
if(W.germ_level > 100 && prob(10))
owner.adjustToxLoss(1 * wound_update_accuracy)
if(W.germ_level > 1000)
owner.adjustToxLoss(1 * wound_update_accuracy)
// sync the organ's damage with its wounds
src.update_damages()
@@ -222,6 +230,12 @@
proc/get_damage_fire()
return burn_dam
proc/is_infected()
for(var/datum/wound/W in wounds)
if(W.germ_level > 100)
return 1
return 0
process()
// process wounds, doing healing etc., only do this every 4 ticks to save processing power
if(owner.life_tick % wound_update_accuracy == 0)
@@ -239,6 +253,9 @@
return
if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT))
src.fracture()
if(germ_level > 0)
for(var/datum/wound/W in wounds) if(!W.bandaged)
W.germ_level = max(W.germ_level, germ_level)
return
proc/fracture()
@@ -694,4 +711,4 @@ obj/item/weapon/organ/r_hand
icon_state = "r_hand_l"
obj/item/weapon/organ/r_leg
name = "right leg"
icon_state = "r_leg_l"
icon_state = "r_leg_l"

View File

@@ -41,6 +41,9 @@
// internal wounds can only be fixed through surgery
var/internal = 0
// amount of germs in the wound
var/germ_level = 0
// helper lists
var/tmp/list/desc_list = list()
var/tmp/list/damage_list = list()
@@ -143,7 +146,7 @@
/datum/wound/gaping_wound
max_bleeding_stage = 2
stages = list("gaping wound" = 50, "large blood soaked clot" = 25, "large clot" = 15, "small angry scar" = 5, \
"small straight scar" = 0)
"small straight scar" = 0)
/datum/wound/big_gaping_wound
max_bleeding_stage = 2
@@ -229,4 +232,4 @@
stages = list("severed vein" = 30, "cut vein" = 20, "damaged vein" = 10, "bruised vein" = 5)
max_bleeding_stage = 0
needs_treatment = 1
needs_treatment = 1

View File

@@ -9,6 +9,7 @@
var/last_bumped = 0
var/pass_flags = 0
var/throwpass = 0
var/germ_level = 0 // The higher the germ level, the more germ on the atom.
///Chemistry.
var/datum/reagents/reagents = null
@@ -121,7 +122,7 @@
* Recursevly searches all atom contens (including contents contents and so on).
*
* ARGS: path - search atom contents for atoms of this type
* list/filter_path - if set, contents of atoms not of types in this list are excluded from search.
* list/filter_path - if set, contents of atoms not of types in this list are excluded from search.
*
* RETURNS: list of found atoms
*/
@@ -419,8 +420,8 @@ its easier to just keep the beam vertical.
A.fingerprints = list()
if(!istype(A.fingerprintshidden,/list))
A.fingerprintshidden = list()
A.fingerprints |= fingerprints //detective
A.fingerprintshidden |= fingerprintshidden //admin
A.fingerprints |= fingerprints //detective
A.fingerprintshidden |= fingerprintshidden //admin
A.fingerprintslast = fingerprintslast
@@ -555,6 +556,7 @@ its easier to just keep the beam vertical.
/atom/proc/clean_blood()
clean_prints()
src.germ_level = 0
if(istype(blood_DNA, /list))
del(blood_DNA)
return 1

View File

@@ -221,7 +221,7 @@
msg_admin_attack("ATTACK: [user.name] ([user.ckey]) attacked [M.name] ([M.ckey]) with [src.name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(src.damtype)])") //BS12 EDIT ALG
//spawn(1800) // this wont work right
//spawn(1800) // this wont work right
// M.lastattacker = null
/////////////////////////
@@ -624,7 +624,7 @@
user << "\red You're going to need to remove that mask/helmet/glasses first."
return
if(istype(M, /mob/living/carbon/alien) || istype(M, /mob/living/carbon/metroid))//Aliens don't have eyes./N Metroids also don't have eyes!
if(istype(M, /mob/living/carbon/alien) || istype(M, /mob/living/carbon/metroid))//Aliens don't have eyes./N Metroids also don't have eyes!
user << "\red You cannot locate any eyes on this creature!"
return

View File

@@ -138,6 +138,9 @@ MASS SPECTROMETER
if(e.status & ORGAN_BROKEN)
if(((e.name == "l_arm") || (e.name == "r_arm") || (e.name == "l_leg") || (e.name == "r_leg")) && (!(e.status & ORGAN_SPLINTED)))
user << "\red Unsecured fracture in subject [limb]. Splinting recommended for transport."
if(e.is_infected())
user << "\red Infected wound detected in subject [limb]. Disinfection recommended."
for(var/name in H.organs_by_name)
var/datum/organ/external/e = H.organs_by_name[name]
if(e.status & ORGAN_BROKEN)

View File

@@ -353,10 +353,12 @@
if(H.gloves)
if(H.gloves.clean_blood())
H.update_inv_gloves(0)
H.gloves.germ_level = 0
else
if(H.bloody_hands)
H.bloody_hands = 0
H.update_inv_gloves(0)
H.germ_level = 0
update_icons() //apply the now updated overlays to the mob

View File

@@ -280,6 +280,8 @@
var/this_wound_desc = W.desc
if(W.bleeding()) this_wound_desc = "bleeding [this_wound_desc]"
else if(W.bandaged) this_wound_desc = "bandaged [this_wound_desc]"
if(W.germ_level > 1000) this_wound_desc = "badly infected [this_wound_desc]"
else if(W.germ_level > 100) this_wound_desc = "infected [this_wound_desc]"
if(this_wound_desc in wound_descriptors)
wound_descriptors[this_wound_desc] += W.amount
continue

View File

@@ -943,3 +943,10 @@
if(wear_suit && wear_suit.flags_inv & HIDEJUMPSUIT && ((head && head.flags_inv & HIDEMASK) || wear_mask))
return NEUTER
return gender
/mob/living/carbon/human/proc/increase_germ_level(n)
if(gloves)
gloves.germ_level += n
else
germ_level += n

View File

@@ -1166,6 +1166,12 @@
if(druggy)
druggy = max(druggy-1, 0)
// Increase germ_level by 1 on each life tick
germ_level += 1
// If you're dirty, your gloves will become dirty, too.
if(gloves && germ_level > gloves.germ_level && prob(30))
gloves.germ_level += 1
return 1
proc/handle_regular_hud_updates()
@@ -1535,4 +1541,4 @@
Paralyse(rand(15,28))
#undef HUMAN_MAX_OXYLOSS
#undef HUMAN_CRIT_MAX_OXYLOSS
#undef HUMAN_CRIT_MAX_OXYLOSS