WIP bloodloss and scaring system.

This commit is contained in:
SkyMarshal
2012-03-25 20:45:00 -07:00
parent e368330143
commit 01d2d5f339
13 changed files with 326 additions and 140 deletions
+5 -1
View File
@@ -503,7 +503,6 @@ Traitors and the like can also be revived with the previous role mostly intact.
e.brute_dam = 0.0
e.burn_dam = 0.0
e.bandaged = 0.0
e.wound_size = 0.0
e.max_damage = initial(e.max_damage)
e.bleeding = 0
e.open = 0
@@ -511,6 +510,11 @@ Traitors and the like can also be revived with the previous role mostly intact.
e.destroyed = 0
e.perma_injury = 0
e.update_icon()
H.vessel = new/datum/reagents(560)
H.vessel.my_atom = H
H.vessel.add_reagent("blood",560)
spawn(1)
H.fixblood()
H.update_body()
H.update_face()
H.UpdateDamageIcon()
+51 -36
View File
@@ -965,55 +965,60 @@
if(istype(target, /mob/living/carbon))//maybe just add a blood reagent to all mobs. Then you can suck them dry...With hundreds of syringes. Jolly good idea.
var/amount = src.reagents.maximum_volume - src.reagents.total_volume
var/mob/living/carbon/T = target
var/datum/reagent/B = new /datum/reagent/blood
if(!T.dna)
usr << "You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum)"
return
if(T.mutations & HUSK) //target done been et, no more blood in him
user << "\red You are unable to locate any blood."
return
B.holder = src
B.volume = amount
//set reagent data
B.data["donor"] = T
/*
if(T.virus && T.virus.spread_type != SPECIAL)
B.data["virus"] = new T.virus.type(0)
*/
if(ishuman(T))
if(T:vessel.get_reagent_amount("blood") < amount)
return
T:vessel.trans_to(src, amount)
else
var/datum/reagent/B = new /datum/reagent/blood
B.holder = src
B.volume = amount
//set reagent data
B.data["donor"] = T
/*
if(T.virus && T.virus.spread_type != SPECIAL)
B.data["virus"] = new T.virus.type(0)
*/
for(var/datum/disease/D in T.viruses)
if(!B.data["viruses"])
B.data["viruses"] = list()
for(var/datum/disease/D in T.viruses)
if(!B.data["viruses"])
B.data["viruses"] = list()
B.data["viruses"] += new D.type
B.data["viruses"] += new D.type
// not sure why it was checking if(B.data["virus2"]), but it seemed wrong
if(T.virus2)
B.data["virus2"] = T.virus2.getcopy()
// not sure why it was checking if(B.data["virus2"]), but it seemed wrong
if(T.virus2)
B.data["virus2"] = T.virus2.getcopy()
B.data["blood_DNA"] = copytext(T.dna.unique_enzymes,1,0)
if(T.resistances&&T.resistances.len)
B.data["resistances"] = T.resistances.Copy()
if(istype(target, /mob/living/carbon/human))//I wish there was some hasproperty operation...
B.data["blood_type"] = copytext(T.dna.b_type,1,0)
var/list/temp_chem = list()
for(var/datum/reagent/R in target.reagents.reagent_list)
temp_chem += R.name
temp_chem[R.name] = R.volume
B.data["trace_chem"] = list2params(temp_chem)
B.data["antibodies"] = T.antibodies
//debug
//for(var/D in B.data)
// world << "Data [D] = [B.data[D]]"
//debug
B.data["blood_DNA"] = copytext(T.dna.unique_enzymes,1,0)
if(T.resistances&&T.resistances.len)
B.data["resistances"] = T.resistances.Copy()
if(istype(target, /mob/living/carbon/human))//I wish there was some hasproperty operation...
B.data["blood_type"] = copytext(T.dna.b_type,1,0)
var/list/temp_chem = list()
for(var/datum/reagent/R in target.reagents.reagent_list)
temp_chem += R.name
temp_chem[R.name] = R.volume
B.data["trace_chem"] = list2params(temp_chem)
B.data["antibodies"] = T.antibodies
//debug
//for(var/D in B.data)
// world << "Data [D] = [B.data[D]]"
//debug
src.reagents.reagent_list += B
src.reagents.update_total()
src.on_reagent_change()
src.reagents.handle_reactions()
src.reagents.reagent_list += B
src.reagents.update_total()
src.on_reagent_change()
src.reagents.handle_reactions()
user << "\blue You take a blood sample from [target]"
for(var/mob/O in viewers(4, user))
O.show_message("\red [user] takes a blood sample from [target].", 1)
@@ -1068,7 +1073,17 @@
if(ismob(target) && target == user)
src.reagents.reaction(target, INGEST)
spawn(5)
var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
var/datum/reagent/blood/B
for(var/datum/reagent/blood/d in src.reagents.reagent_list)
B = d
break
var/trans
if(B && ishuman(target))
var/mob/living/carbon/human/H = target
H.vessel.add_reagent("blood",5,B)
src.reagents.remove_reagent("blood",5)
else
trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units."
if (reagents.total_volume <= 0 && mode==SYRINGE_INJECT)
mode = SYRINGE_DRAW
+54 -14
View File
@@ -179,31 +179,71 @@
usr << "\red [src.name] doesn't seem as though they want to talk."
spawn(10) // I think we might be overloading the clients.
var/list/wound_descriptions = list()
for(var/named in organs)
var/datum/organ/external/temp = organs[named]
if(temp)
if(temp.destroyed)
usr << "\red [src.name] is missing [t_his] [temp.display_name]."
continue
if(temp.wounds)
for(var/datum/organ/external/wound/w in temp.wounds)
var/size = w.wound_size
var/sizetext
switch(size)
var/list/wounds = list(list(),list(),list(),list(),list(),list())
for(var/datum/organ/wound/w in temp.wounds)
switch(w.healing_state)
if(0)
var/list/cut = wounds[1]
cut += w
wounds[1] = cut
if(1)
sizetext = "cut"
var/list/cut = wounds[2]
cut += w
wounds[2] = cut
if(2)
sizetext = "deep cut"
var/list/cut = wounds[3]
cut += w
wounds[3] = cut
if(3)
sizetext = "flesh wound"
var/list/cut = wounds[4]
cut += w
wounds[4] = cut
if(4)
sizetext = "gaping wound"
var/list/cut = wounds[5]
cut += w
wounds[5] = cut
if(5)
sizetext = "big gaping wound"
if(6)
sizetext = "massive wound"
if(w.bleeding)
usr << "\red [src.name] is bleeding from a [sizetext] on [t_his] [temp.display_name]."
continue
var/list/cut = wounds[6]
cut += w
wounds[6] = cut
wound_descriptions["[temp.display_name]"] = wounds
//Now that we have a big list of all the wounds, on all the limbs.
var/list/wound_flavor_text = list()
for(var/named in wound_descriptions)
var/list/wound_states = wound_descriptions[named]
for(var/i = 1, i <= 6, i++)
var/list/wound_state = wound_states[i] //All wounds at this level of healing.
var/list/tally = list("cut" = 0, "deep cut" = 0, "flesh wound" = 0, "gaping wound" = 0, "big gaping wound" = 0, "massive wound" = 0) //How many wounds of what size.
for(var/datum/organ/wound/w in wound_state)
switch(w.wound_size)
if(1)
tally["cut"] += 1
if(2)
tally["deep cut"] += 1
if(3)
tally["flesh wound"] += 1
if(4)
tally["gaping wound"] += 1
if(5)
tally["big gaping wound"] += 1
if(6)
tally["massive wound"] += 1
for(var/tallied in tally)
if(!tally[tallied])
continue
// if(w.bleeding)
// usr << "\red [src.name] is bleeding from a [sizetext] on [t_his] [temp.display_name]."
// continue
print_flavor_text()
+55 -12
View File
@@ -54,12 +54,13 @@
var/list/body_standing = list()
var/list/body_lying = list()
var/organs2 = list()
var/mutantrace = null
var/bloodloss = 0
var/debug_leftarm
var/debug_lefthand
var/datum/reagents/vessel
var/pale = 0
/mob/living/carbon/human/dummy
real_name = "Test Dummy"
@@ -75,25 +76,26 @@
if(!dna) dna = new /datum/dna(null)
new /datum/organ/external/chest(src)
new /datum/organ/external/groin(src)
new /datum/organ/external/head(src)
new /datum/organ/external/l_arm(src)
new /datum/organ/external/r_arm(src)
new /datum/organ/external/r_leg(src)
new /datum/organ/external/l_leg(src)
organs2 += new /datum/organ/external/chest(src)
organs2 += new /datum/organ/external/groin(src)
organs2 += new /datum/organ/external/head(src)
organs2 += new /datum/organ/external/l_arm(src)
organs2 += new /datum/organ/external/r_arm(src)
organs2 += new /datum/organ/external/r_leg(src)
organs2 += new /datum/organ/external/l_leg(src)
var/datum/organ/external/part = new /datum/organ/external/l_hand(src)
part.parent = organs["l_arm"]
organs2 += part
part = new /datum/organ/external/l_foot(src)
part.parent = organs["l_leg"]
organs2 += part
part = new /datum/organ/external/r_hand(src)
part.parent = organs["r_arm"]
organs2 += part
part = new /datum/organ/external/r_foot(src)
part.parent = organs["r_leg"]
debug_leftarm = organs["l_arm"]
debug_lefthand = organs["l_hand"]
organs2 += part
var/g = "m"
if (gender == MALE)
@@ -113,12 +115,50 @@
update_clothing()
src << "\blue Your icons have been generated!"
vessel = new/datum/reagents(560)
vessel.my_atom = src
vessel.add_reagent("blood",560)
spawn(1) fixblood()
..()
/*var/known_languages = list()
known_languages.Add("english")*/
// organStructure = new /obj/effect/organstructure/human(src)
/mob/living/carbon/human/proc/fixblood()
for(var/datum/reagent/blood/B in vessel.reagent_list)
if(B.id == "blood")
B.data["blood_type"] = dna.b_type
B.data["blood_DNA"] = dna.unique_enzymes
B.data["donor"] = src
if(virus2)
B.data["virus2"] = virus2.getcopy()
/mob/living/carbon/human/proc/drip(var/amt as num)
if(!amt)
return
var/turf/T = get_turf(src)
var/list/obj/effect/decal/cleanable/blood/drip/nums
var/amm = 0.1 * amt
vessel.remove_reagent("blood",amm)
for(var/obj/effect/decal/cleanable/blood/drip/G in T)
nums += G
if(nums.len >= 3)
var/obj/effect/decal/cleanable/blood/drip/D = pick(nums)
D.blood_DNA.len++
D.blood_DNA[D.blood_DNA.len] = list(dna.unique_enzymes,dna.b_type)
if(virus2)
D.virus2 += virus2.getcopy()
return
var/obj/effect/decal/cleanable/blood/this = new(T)
var/hax = pick("1","2","3","4","5")
this.icon_state = hax
this.blood_DNA = list(list(dna.unique_enzymes,dna.b_type))
this.blood_owner = src
if(virus2)
this.virus2 = virus2.getcopy()
/mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes)
if ((!( yes ) || now_pushing))
return
@@ -1351,6 +1391,9 @@
else
stand_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
lying_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
if(pale)
stand_icon.Blend(rgb(100,100,100))
lying_icon.Blend(rgb(100,100,100))
if (underwear > 0)
//if(!obese)
+43 -8
View File
@@ -750,6 +750,7 @@
handle_chemicals_in_body()
if(reagents && stat != 2) reagents.metabolize(src)
if(vessel && stat != 2) vessel.metabolize(src)
if(mutantrace == "plant") //couldn't think of a better place to place it, since it handles nutrition -- Urist
var/light_amount = 0 //how much light there is in the place, affects receiving nutrition and healing
@@ -826,6 +827,10 @@
return //TODO: DEFERRED
updatepale()
pale = !pale
update_body()
handle_regular_status_updates()
var/leg_tally = 2
for(var/name in organs)
@@ -850,6 +855,39 @@
emote("collapse")
paralysis = 10
if(stat < 2)
var/blood_volume = round(vessel.get_reagent_amount("blood"))
if(bloodloss)
drip(bloodloss)
if(!blood_volume)
bloodloss = 0
else if(blood_volume > 448)
if(pale)
pale = 0
updatepale()
else if(blood_volume <= 448 && blood_volume > 336)
if(!pale)
updatepale()
pale = 1
var/word = pick("dizzy","woosey","faint")
src << "\red You feel [word]"
if(prob(1))
var/word = pick("dizzy","woosey","faint")
src << "\red You feel [word]"
else if(blood_volume <= 336 && blood_volume > 244)
if(!pale)
updatepale()
pale = 1
eye_blurry += 6
if(prob(15))
paralysis += rand(1,3)
else if(blood_volume <= 244 && blood_volume > 122)
if(toxloss <= 100)
toxloss = 100
else if(blood_volume <= 122)
death()
//src.unlock_medal("We're all sold out on blood", 0, "You bled to death..", "easy")
updatehealth()
// health = 100 - (getOxyLoss() + getToxLoss() + getFireLoss() + getBruteLoss() + getCloneLoss())
@@ -924,16 +962,13 @@
var/datum/organ/external/temp = organs[name]
if(!temp.bleeding)
continue
else
if(prob(35))
bloodloss += rand(1,10)
// else
// if(prob(35))
// bloodloss += rand(1,10)
if(temp.wounds)
for(var/datum/organ/external/wound/W in temp.wounds)
if(!temp.bleeding)
continue
else
if(prob(25))
bloodloss++
if(prob(10*W.woundsize) && W.bleeding)
bloodloss++
if (eye_blind)
eye_blind--
blinded = 1
+2 -1
View File
@@ -175,8 +175,9 @@
affecting.heal_damage(1000, 1000) //fixes getting hit after ingestion, killing you when game updates organ health
affecting.broken = 0
affecting.destroyed = 0
for(var/datum/organ/external/wound/W in affecting.wounds)
for(var/datum/organ/wound/W in affecting.wounds)
W.stopbleeding()
del(W)
H.UpdateDamageIcon()
H.update_body()
//src.fireloss = 0
+33 -16
View File
@@ -45,7 +45,6 @@
burn_dam = 0
bandaged = 0
max_damage = 0
wound_size = 0
max_size = 0
obj/item/weapon/implant/implant = null
@@ -301,27 +300,45 @@
proc/createwound(var/size = 1)
if(ishuman(src.owner))
var/datum/organ/external/wound/W = new(src)
W.bleeding = 1
src.owner:bloodloss += 10 * size
var/datum/organ/wound/W = new(src)
bleeding = 1
owner:bloodloss += 10 * size
W.wound_size = size
W.owner = src.owner
src.wounds += W
W.parent = src
wounds += W
/datum/organ/external/wound
/datum/organ/wound
name = "wound"
wound_size = 1
icon_name = "wound"
display_name = "wound"
parent = null
var/wound_size = 1
var/datum/organ/external/parent
var/bleeding = 1 //You got wounded, of course it's bleeding.
var/healing_state = 0
proc/stopbleeding()
if(!src.bleeding)
return
var/t = 10 * src.wound_size
src.owner:bloodloss -= t
src.bleeding = 0
del(src)
if(!bleeding)
return 0
owner:bloodloss -= 10 * src.wound_size
parent.bleeding = 0
for(var/datum/organ/wound/W in parent)
if(W.bleeding && W != src)
parent.bleeding = 1
bleeding = 0
spawn become_scar() //spawn off the process of becoming a scar.
return 1
proc/become_scar()
healing_state = 1 //Patched
sleep(rand(1800,3000)) //3-5 minutes
healing_state = 2 //Noticibly healing.
sleep(rand(1800,3000)) //3-5 minutes
healing_state = 3 //Angry red scar
sleep(rand(6000,9000)) //10-15 minutes
healing_state = 4 //Scar
sleep(rand(6000,9000)) //10-15 minutes
healing_state = 5 //Faded scar
return
/****************************************************
INTERNAL ORGANS