Fix species radiation multipliers (#1325)

Fixes radiation so species' radiation_mod values are actually applied.
Refactored radiation application to use proc apply_radiation() instead of directly modifying the variable.
This commit is contained in:
Lohikar
2016-12-27 17:15:20 -06:00
committed by skull132
parent fbe0ea9c25
commit 982bf9b1a1
19 changed files with 56 additions and 41 deletions

View File

@@ -26,11 +26,11 @@
// Currently both Dionaea and larvae like to eat radiation, so I'm defining the
// rad absorbtion here. This will need to be changed if other baby aliens are added.
if(!radiation)
if(!total_radiation)
return
var/rads = radiation/25
radiation -= rads
var/rads = total_radiation/25
apply_radiation(rads*-1)
nutrition += rads
heal_overall_damage(rads,rads)
adjustOxyLoss(-(rads))

View File

@@ -2,26 +2,26 @@
return
/mob/living/carbon/brain/handle_mutations_and_radiation()
if (radiation)
if (radiation > 100)
radiation = 100
if (total_radiation)
if (total_radiation > 100)
total_radiation = 100
if(!container)//If it's not in an MMI
src << "\red You feel weak."
else//Fluff-wise, since the brain can't detect anything itself, the MMI handles thing like that
src << "\red STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED."
switch(radiation)
switch(total_radiation)
if(1 to 49)
radiation--
apply_radiation(-1)
if(prob(25))
adjustToxLoss(1)
updatehealth()
if(50 to 74)
radiation -= 2
apply_radiation(-2)
adjustToxLoss(1)
if(prob(5))
radiation -= 5
apply_radiation(-5)
if(!container)
src << "\red You feel weak."
else
@@ -29,7 +29,7 @@
updatehealth()
if(75 to 100)
radiation -= 3
apply_radiation(-3)
adjustToxLoss(3)
updatehealth()

View File

@@ -55,6 +55,8 @@ var/list/diona_banned_languages = list(
//Converts radiation to stored energy if its needed, and gives messages related to radiation
//Rads can be used to heal in place of light energy, that is handled in the regular regeneration proc
var/radiation = total_radiation
if (radiation && DS.stored_energy < (DS.max_energy * 0.8))//Radiation can provide energy in place of light
radiation -= 2
DS.stored_energy += 2
@@ -116,10 +118,10 @@ var/list/diona_banned_languages = list(
//Most medicines don't work on diona, but physical treatment for external wounds helps a little,
//and some alternative things that are toxic to other life, such as radium and mutagen, will benefit diona
/mob/living/carbon/proc/diona_handle_regeneration(var/datum/dionastats/DS)
if ((DS.stored_energy < 1 && !radiation))//we need energy or radiation to heal
if ((DS.stored_energy < 1 && !total_radiation))//we need energy or radiation to heal
return
radiation = max(radiation, 0)
var/radiation = max(total_radiation, 0)
var/value //A little variable we'll reuse to optimise

View File

@@ -401,3 +401,8 @@ This function restores all organs.
updatehealth()
BITSET(hud_updateflag, HEALTH_HUD)
return 1
/mob/living/carbon/human/apply_radiation(var/rads)
if (species && rads > 0)
rads = rads * species.radiation_mod
..(rads)

View File

@@ -281,24 +281,24 @@
speech_problem_flag = 1
gene.OnMobLife(src)
radiation = Clamp(radiation,0,100)
total_radiation = Clamp(total_radiation,0,100)
// #TODO-MERGE: Check vaurca and IPC radiation management
if (radiation)
if (total_radiation)
//var/obj/item/organ/diona/nutrients/rad_organ = locate() in internal_organs
if(src.is_diona())
diona_handle_regeneration(get_dionastats())
else
var/damage = 0
radiation -= 1 * RADIATION_SPEED_COEFFICIENT
total_radiation -= 1 * RADIATION_SPEED_COEFFICIENT
if(prob(25))
damage = 1
if (radiation > 50)
if (total_radiation > 50)
damage = 1
radiation -= 1 * RADIATION_SPEED_COEFFICIENT
total_radiation -= 1 * RADIATION_SPEED_COEFFICIENT
if(prob(5) && prob(100 * RADIATION_SPEED_COEFFICIENT))
radiation -= 5 * RADIATION_SPEED_COEFFICIENT
src.apply_radiation(-5 * RADIATION_SPEED_COEFFICIENT)
src << "<span class='warning'>You feel weak.</span>"
Weaken(3)
if(!lying)
@@ -310,8 +310,8 @@
f_style = "Shaved"
update_hair()
if (radiation > 75)
radiation -= 1 * RADIATION_SPEED_COEFFICIENT
if (total_radiation > 75)
src.apply_radiation(-1 * RADIATION_SPEED_COEFFICIENT)
damage = 3
if(prob(5))
take_overall_damage(0, 5 * RADIATION_SPEED_COEFFICIENT, used_weapon = "Radiation Burns")

View File

@@ -275,13 +275,13 @@
var/remainder = cost * sprint_cost_factor
if (H.radiation)
if (H.radiation > (cost*0.5))//Radiation counts as double energy
H.radiation -= cost*0.5
if (H.total_radiation)
if (H.total_radiation > (cost*0.5))//Radiation counts as double energy
H.apply_radiation(cost*(-0.5))
return 1
else
remainder = cost - (H.radiation*2)
H.radiation = 0
remainder = cost - (H.total_radiation*2)
H.total_radiation = 0
if (DS.stored_energy > remainder)
DS.stored_energy -= remainder
@@ -343,6 +343,7 @@
num_alternate_languages = 2
secondary_langs = list("Encoded Audio Language")
ethanol_resistance = -1//Can't get drunk
radiation_mod = 0 // not affected by radiation
eyes = "blank_eyes"
// #TODO-MERGE: Check for balance and self-repair. If self-repair is a thing, RIP balance.

View File

@@ -54,7 +54,7 @@
adjustHalLoss(effect) //Changed this to use the wrapper function, it shouldn't directly alter the value
if(IRRADIATE)
var/rad_protection = check_protection ? getarmor(null, "rad")/100 : 0
radiation += max((1-rad_protection)*effect/(blocked+1),0)//Rads auto check armor
apply_radiation(max((1-rad_protection)*effect/(blocked+1),0))//Rads auto check armor
if(STUTTER)
if(status_flags & CANSTUN) // stun is usually associated with stutter
stuttering = max(stuttering,(effect/(blocked+1)))
@@ -81,3 +81,9 @@
if(agony) apply_effect(agony, AGONY, blocked)
if(incinerate) apply_effect(incinerate, INCINERATE, blocked)
return 1
// overridden by human
/mob/living/proc/apply_radiation(var/rads)
total_radiation += rads
if (total_radiation < 0)
total_radiation = 0

View File

@@ -442,7 +442,7 @@ default behaviour is:
SetWeakened(0)
// shut down ongoing problems
radiation = 0
total_radiation = 0
nutrition = 400
bodytemperature = T20C
sdisabilities = 0

View File

@@ -67,3 +67,5 @@
var/exhaust_threshold = 50
var/move_delay_mod = 0//Added to move delay, used for calculating movement speeds. Provides a centralised value for modifiers to alter
var/total_radiation // DON'T MODIFY THIS DIRECTLY. USE apply_radiation()!

View File

@@ -159,7 +159,6 @@
var/can_pull_mobs = MOB_PULL_LARGER // Whether or not the mob can pull other mobs.
var/datum/dna/dna = null//Carbon
var/radiation = 0.0//Carbon
var/list/mutations = list() //Carbon -- Doohl
//see: setup.dm for list of mutations